def __init__(self, name, function, **kwargs): CommandVerb.__init__(self, name, function, **kwargs) self.modifiers = utility.kwargs_get_list(kwargs, 'modifiers', default = []) if not self.modifiers: utility.abort('Multi-command "%s" must provide a "modifiers" list.' % self.name) valid_modifiers = '|'.join([mod.name for mod in self.modifiers]) has_args = 0 rows = [] for mod in self.modifiers: if mod.arg_name: usage = '%s %s [ %s ... ]' % (self.name, mod.name, mod.arg_name) has_args += 1 else: usage = '%s %s' % (self.name, mod.name) rows.append((usage, mod.description)) caption = '"%s" Command Variations' % self.name other_info = utility.format_table(rows, caption = caption, separator = ' ') self.set_defaults(other_info = other_info.strip()) args = [ cli.StringArgument('modifier', 'command modifier (valid modifiers: %s)' % valid_modifiers)] if has_args > 0: if has_args == len(self.modifiers): arg_desc = 'optional arguments(s)' else: arg_desc = 'optional arguments(s) (where applicable)' args.append(cli.StringArgument('arg', arg_desc, min_count = 0, max_count = None)) self.add_arguments(*args)
def __init__(self, name, function, **kwargs): CommandVerb.__init__(self, name, function, **kwargs) self.set_defaults( description='Create a runnable Python program package.', baseverb=True, hideverb=True, description2=''' The optional NAME argument(s) allow package generation for base commands other than the current one. If no NAME is provided the current base command is packaged.''') self.add_options( cli.BooleanOption('-f', '--force', 'force', 'overwrite existing file without asking', default=False), cli.StringOption( '-o', '--output_dir', 'output_dir', 'specify the output directory (defaults to the working directory)' )) self.add_arguments( cli.StringArgument('name', 'base command name', min_count=0, max_count=None))
def __init__(self, name, function, server_subcommand, **kwargs): JavaVerb.__init__(self, name, function, 'org.voltdb.VoltDB', **kwargs) self.server_subcommand = server_subcommand # Add common server-ish options. self.add_options( cli.StringOption('-d', '--deployment', 'deployment', 'the deployment configuration file path', default='deployment.xml'), cli.HostOption('-H', '--host', 'host', 'the host', default='localhost'), cli.StringOption('-l', '--license', 'license', 'the license file path')) self.add_arguments( cli.StringArgument('catalog', 'the application catalog jar file path')) # Add appropriate server-ish Java options. self.merge_java_options('java_opts_override', '-server', '-XX:+HeapDumpOnOutOfMemoryError', '-XX:HeapDumpPath=/tmp', '-XX:-ReduceInitialCardMarks')
def __init__(self, name, function, **kwargs): CommandVerb.__init__(self, name, function, **kwargs) self.set_defaults(description = 'Display general or verb-specific help.', baseverb = True) self.add_options( cli.BooleanOption('-a', '--all', 'all', 'display all available help, including verb usage')) self.add_arguments( cli.StringArgument('verb', 'verb name', min_count = 0, max_count = None))