-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ Added support for subcommands * add test * document Co-authored-by: s-weigand <s.weigand.phy@gmail.com>
- Loading branch information
1 parent
a73e525
commit 8e986fd
Showing
5 changed files
with
51 additions
and
13 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
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,18 @@ | ||
"""Local module with subcommand.""" | ||
import argparse | ||
import sys | ||
from typing import Optional, Sequence | ||
|
||
|
||
def main(argv: Optional[Sequence[str]] = None) -> int: | ||
"""Print word (subcommand), ignore paths""" | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("word", nargs=1) | ||
parser.add_argument("paths", nargs="*") | ||
args = parser.parse_args(argv) | ||
print(args.word) | ||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
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