예제 #1
0
-P, --passwd-file= f  Get passphrase from file 'f'.
-q, --quiet           Produce quieter output
-r, --usr-randchars=n Get 'n' characters of additional randomness from
                      user (min={g.min_urandchars}, max={g.max_urandchars})
-v, --verbose         Produce more verbose output
""".format(g=g),
	'notes': """

                               COMMANDS
{}
Type '{} help <command> for help on a particular command
""".format(cmd_help,g.prog_name)
}

cmd_args = opts.init(opts_data,add_opts=['hidden_incog_input_params','in_fmt'])

if len(cmd_args) < 1: opts.usage()

Command = cmd_args.pop(0).capitalize()

import mmgen.tool as tool

if Command == 'Help' and not cmd_args: tool.usage(None)

if Command not in tool.cmd_data:
	die(1,"'%s': no such command" % Command.lower())

args,kwargs = tool.process_args(Command,cmd_args)
ret = tool.__dict__[Command](*args,**kwargs)
sys.exit(0 if ret in (None,True) else 1) # some commands die, some return False on failure
예제 #2
0
{ch}
Type '{pn} help <command> for help on a particular command
""".format( pn=g.prog_name,
			ch=cmd_help.format(
				pn=g.proto.name,
				pnm=g.proj_name,
				sm='\n  '.join(stdin_msg.split('\n')))
	)
}

cmd_args = opts.init(opts_data,add_opts=['hidden_incog_input_params','in_fmt'])

if len(cmd_args) < 1: opts.usage()

Command = cmd_args.pop(0).capitalize()

import mmgen.tool as tool

if Command == 'Help' and not cmd_args: tool.usage(None)

if Command not in tool.cmd_data:
	die(1,"'%s': no such command" % Command.lower())

args,kwargs = tool.process_args(Command,cmd_args)
try:
	ret = tool.__dict__[Command](*args,**kwargs)
except Exception as e:
	die(1,'{}'.format(e))

sys.exit(0 if ret in (None,True) else 1) # some commands die, some return False on failure