Print usage if no action is specified
This commit is contained in:
parent
e05a024a79
commit
bc623fc93f
@ -29,9 +29,13 @@ def ls(session: sa.orm.Session):
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
def none(parser: argparse.ArgumentParser):
|
||||||
|
parser.print_usage()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
import argparse
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
@ -41,6 +45,7 @@ if __name__ == '__main__':
|
|||||||
}
|
}
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.set_defaults(func=lambda x: none(parser))
|
||||||
subparsers = parser.add_subparsers()
|
subparsers = parser.add_subparsers()
|
||||||
|
|
||||||
add_parser = subparsers.add_parser('add')
|
add_parser = subparsers.add_parser('add')
|
||||||
|
Loading…
Reference in New Issue
Block a user