Treat empty CLI args as error and show usage

This commit is contained in:
Disassembler 2021-07-11 15:39:14 +02:00
parent 0b585dee0d
commit 5bc8a878dc
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
2 changed files with 2 additions and 2 deletions

View File

@ -79,8 +79,7 @@ def prune():
def parse_args(args=None):
parser = argparse.ArgumentParser(description='SPOC application manager')
parser.set_defaults(action=None)
subparsers = parser.add_subparsers()
subparsers = parser.add_subparsers(dest='action', required=True)
parser_list = subparsers.add_parser('list')
parser_list.set_defaults(action=listing)

View File

@ -317,6 +317,7 @@ def test_main_invalid(prune, login, stop_all, start_autostarted, status, stop, s
['autostart', 'someapp'],
['login'],
['invalid'],
[],
])
def test_main_systemexit(argv):
argv.insert(0, 'foo')