cli: make devscripts subcommand more accessible
This commit is contained in:
parent
4e356f122a
commit
8161e5e92a
|
@ -7,6 +7,7 @@ from sqlalchemy.orm import Session
|
||||||
from .services import (
|
from .services import (
|
||||||
Config,
|
Config,
|
||||||
arg_parser,
|
arg_parser,
|
||||||
|
devscripts_arg_parser,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .deadline_daemon import DeadlineDaemon
|
from .deadline_daemon import DeadlineDaemon
|
||||||
|
@ -69,7 +70,7 @@ def main():
|
||||||
from .devscripts.seed_test_data import main
|
from .devscripts.seed_test_data import main
|
||||||
main(sql_session)
|
main(sql_session)
|
||||||
else:
|
else:
|
||||||
print(f'Error: no such script: {args.script}')
|
print(devscripts_arg_parser.format_help())
|
||||||
exit(1)
|
exit(1)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
@ -83,4 +84,5 @@ def main():
|
||||||
flask_prod_main()
|
flask_prod_main()
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
print(arg_parser.format_help())
|
print(arg_parser.format_help())
|
||||||
|
exit(1)
|
|
@ -1,4 +1,7 @@
|
||||||
from .argument_parser import arg_parser
|
from .argument_parser import (
|
||||||
|
arg_parser,
|
||||||
|
devscripts_arg_parser,
|
||||||
|
)
|
||||||
from .bookcase_item import (
|
from .bookcase_item import (
|
||||||
create_bookcase_item_from_isbn,
|
create_bookcase_item_from_isbn,
|
||||||
is_valid_isbn,
|
is_valid_isbn,
|
||||||
|
|
|
@ -31,12 +31,17 @@ subparsers.add_parser(
|
||||||
help = 'Start the web interface in production mode',
|
help = 'Start the web interface in production mode',
|
||||||
)
|
)
|
||||||
|
|
||||||
subparsers.add_parser(
|
devscripts_arg_parser = subparsers.add_parser('devscripts', help='Run development scripts')
|
||||||
'devscripts',
|
devscripts_subparsers = devscripts_arg_parser.add_subparsers(dest='script')
|
||||||
help = 'Run development scripts',
|
|
||||||
).add_argument(
|
devscripts_subparsers.add_parser(
|
||||||
'script',
|
'seed-test-data',
|
||||||
help = 'The development script to run',
|
help = 'Seed test data in the database',
|
||||||
|
)
|
||||||
|
|
||||||
|
devscripts_subparsers.add_parser(
|
||||||
|
'seed-content-for-deadline-daemon',
|
||||||
|
help = 'Seed data tailorded for testing the deadline daemon, into the database',
|
||||||
)
|
)
|
||||||
|
|
||||||
arg_parser.add_argument(
|
arg_parser.add_argument(
|
||||||
|
|
Loading…
Reference in New Issue