cli: make devscripts subcommand more accessible

This commit is contained in:
Oystein Kristoffer Tveit 2024-07-28 14:32:13 +02:00
parent 4e356f122a
commit 8161e5e92a
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
3 changed files with 19 additions and 9 deletions

View File

@ -7,6 +7,7 @@ from sqlalchemy.orm import Session
from .services import (
Config,
arg_parser,
devscripts_arg_parser,
)
from .deadline_daemon import DeadlineDaemon
@ -69,7 +70,7 @@ def main():
from .devscripts.seed_test_data import main
main(sql_session)
else:
print(f'Error: no such script: {args.script}')
print(devscripts_arg_parser.format_help())
exit(1)
exit(0)
@ -83,4 +84,5 @@ def main():
flask_prod_main()
exit(0)
print(arg_parser.format_help())
print(arg_parser.format_help())
exit(1)

View File

@ -1,4 +1,7 @@
from .argument_parser import arg_parser
from .argument_parser import (
arg_parser,
devscripts_arg_parser,
)
from .bookcase_item import (
create_bookcase_item_from_isbn,
is_valid_isbn,

View File

@ -31,12 +31,17 @@ subparsers.add_parser(
help = 'Start the web interface in production mode',
)
subparsers.add_parser(
'devscripts',
help = 'Run development scripts',
).add_argument(
'script',
help = 'The development script to run',
devscripts_arg_parser = subparsers.add_parser('devscripts', help='Run development scripts')
devscripts_subparsers = devscripts_arg_parser.add_subparsers(dest='script')
devscripts_subparsers.add_parser(
'seed-test-data',
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(