def __init__(self, prompt): Section.__init__(self, 'users', 'manages users in the system') self.prompt = prompt create_command = Command('create', 'creates a new user in the system', self.create) create_command.create_option('--username', 'username for the new user', required=True) create_command.create_option('--password', 'password for the new user', required=True) create_command.create_option('--group', 'group in which to assign the new user', required=False) self.add_command(create_command)
def __init__(self, prompt): Section.__init__(self, 'demo1', 'demo section #1') self.prompt = prompt # Optional Argument Demo usage = 'Unspecified required arguments are listed at the bottom. The full ' \ 'listing of specified arguments is displayed when successfully run.' opt_arg_command = Command('opt-args', 'configured with multiple arguments, many optional', self.optional_args, usage_description=usage) opt_arg_command.create_option('--required-1', 'required argument before this command will actually run', required=True) opt_arg_command.create_option('--optional-1', 'optional argument, value will be displayed when specified', required=False) opt_arg_command.create_option('--optional-2', 'another optional argument', required=False) self.add_command(opt_arg_command)