-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
172 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import json | ||
|
||
from django_typer import TyperCommand | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from django_typer import TyperCommand, command | ||
from typing import List | ||
import json | ||
|
||
|
||
class Command(TyperCommand): | ||
|
||
help = 'Test multiple sub-commands.' | ||
|
||
@command() | ||
def cmd1(files: List[str], flag1: bool = False): | ||
""" | ||
A command that takes a list of files and a flag. | ||
""" | ||
return json.dumps({ | ||
'files': files, | ||
'flag1': flag1 | ||
}) | ||
|
||
@command() | ||
def sum(numbers: List[float]): | ||
""" | ||
Sum the given numbers. | ||
""" | ||
return sum(numbers) | ||
|
||
@command() | ||
def cmd3(): | ||
""" | ||
A command with no arguments. | ||
""" | ||
return json.dumps({}) |
Oops, something went wrong.