/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to mandos-ctl

  • Committer: Teddy Hogeborn
  • Date: 2019-03-03 14:22:37 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 382.
  • Revision ID: teddy@recompile.se-20190303142237-tb8x6rbqms5ku1ws
mandos-ctl: Refactor

* mandos-ctl (commands_and_clients_from_options): Make args to parse
                                                  overrideable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
515
515
                options.deny))
516
516
 
517
517
 
518
 
def commands_and_clients_from_options():
 
518
def commands_and_clients_from_options(args=None):
 
519
    if args is None:
 
520
        args=sys.argv[1:]
519
521
    parser = argparse.ArgumentParser()
520
522
    parser.add_argument("--version", action="version",
521
523
                        version="%(prog)s {}".format(version),
579
581
    parser.add_argument("--check", action="store_true",
580
582
                        help="Run self-test")
581
583
    parser.add_argument("client", nargs="*", help="Client name")
582
 
    options = parser.parse_args()
 
584
    options = parser.parse_args(args=args)
583
585
 
584
586
    if has_actions(options) and not (options.client or options.all):
585
587
        parser.error("Options require clients names or --all.")