Generate a command with given name.
    The command can be run immediately after generation.

    For example:

        dj generate command bar

        dj run manage.py bar
515942
def get_context(name, doc):
    
    name = inflection.underscore(name)
    return {
        'name': name,
        'doc': doc or name
    }
154914
def execute(self, name):
        
        generator = self._get_generator(name)
        generator.initializing()
        answers = generator.prompting(create_store_prompt(name))
        # TODO
        # app.insight.track('yoyo', 'help', answers)
        generator.configuring(answers)
        generator.writing(answers)
114537
def add_command(self, cmd, name=None):
        
        name = name or cmd.name
        if name is None:
            raise TypeError('Command has no name.')
        self.commands[name] = cmd
504335
def _run_command(self, command):
        
        machine_name = self.frame_run_buttons.var_machine.get()
        self._run_dragonpy_cli("--machine", machine_name, command)
398345
def command(subcommand, *arguments)
        args = [vagrant, subcommand.to_s, arguments].flatten
        args.map {|a| Shellwords.escape a }.join(' ').tap do |command|
          logger.debug "Generated command '#{command}' from " +
            "subcommand '#{subcommand.to_s}' with arguments " +
            arguments.inspect
        end
      end
207033
def get_command(name):
    ''''''
    command = global_commands_table.get(name.lower())
    if not command:
        raise CommandNotFound(name)
    return command
375455
def command(settings_module,
            command,
            bin_env=None,
            pythonpath=None,
            env=None,
            runas=None,
            *args, **kwargs):
    '''
    
    '''
    dja = _get_django_admin(bin_env)
    cmd = '{0} {1} --settings={2}'.format(dja, command, settings_module)

    if pythonpath:
        cmd = '{0} --pythonpath={1}'.format(cmd, pythonpath)

    for arg in args:
        cmd = '{0} --{1}'.format(cmd, arg)

    for key, value in six.iteritems(kwargs):
        if not key.startswith('__'):
            cmd = '{0} --{1}={2}'.format(cmd, key, value)
    return __salt__['cmd.run'](cmd, env=env, runas=runas, python_shell=False)
455394
def gen_cmake_command(config):
    
    from autocmake.extract import extract_list

    s = []
    s.append("\n\ndef gen_cmake_command(options, arguments):")
    s.append('    """')
    s.append("    Generate CMake command based on options and arguments.")
    s.append('    """')
    s.append("    command = []")

    for env in config['export']:
        s.append('    command.append({0})'.format(env))

    s.append("    command.append(arguments['--cmake-executable'])")

    for definition in config['define']:
        s.append('    command.append({0})'.format(definition))

    s.append("    command.append('-DCMAKE_BUILD_TYPE={0}'.format(arguments['--type']))")
    s.append("    command.append('-G\"{0}\"'.format(arguments['--generator']))")
    s.append("    if arguments['--cmake-options'] != \"''\":")
    s.append("        command.append(arguments['--cmake-options'])")
    s.append("    if arguments['--prefix']:")
    s.append("        command.append('-DCMAKE_INSTALL_PREFIX=\"{0}\"'.format(arguments['--prefix']))")

    s.append("\n    return ' '.join(command)")

    return '\n'.join(s)
21904
def run_command(self, command_name, config_updates=None,
                    named_configs=(), args=(), meta_info=None):
        
        import warnings
        warnings.warn("run_command is deprecated. Use run instead",
                      DeprecationWarning)
        return self.run(command_name, config_updates, named_configs, meta_info,
                        args)
789933
def make_command(command: Callable) -> Callable:
    """"""
    @wraps(command)
    def actualcommand(self, *args, **kwds):  # pylint: disable=missing-docstring
        data = command(self, *args, **kwds)
        name = command.__name__[3:]
        signal = '{uuid}{sep}{event}'.format(
            uuid=self._uuid,  # pylint: disable=protected-access
            sep=SEPARATOR,
            event=name
        )
        if flask.has_request_context():
            emit(signal, {'data': pack(data)})
        else:
            sio = flask.current_app.extensions['socketio']
            sio.emit(signal, {'data': pack(data)})
        eventlet.sleep()

    return actualcommand
1193364
def _create_command(wrapper, name, return_value, wrap_result):
    
    def mpd_command(self, *args):
        callback = _create_callback(self, return_value, wrap_result)
        return wrapper(self, name, args, callback)
    return mpd_command
413093
def add_command(self, cmd_name, *args):
        """"""
        self.__commands.append(Command(cmd_name, args))
899785
def run(self, command, opts):
        """"""
        handlers = { 
            'create': self.create,
            'delete': self.delete,
            'list': self.list
        }
        handler = handlers.get(command, None)
        if handler is None:
            error("Unrecognized command: %s" % command, 2)
        handler(opts)
752453
def def_cmd(name=None, short=None, fn=None, usage=None, help=None):
    
    command = Command(name=name, short=short, fn=fn, usage=usage, help=help)
    Command.register(command)
418859
def define_command(name = nil, &block)
      # Execute DSL
      dsl = Cri::CommandDSL.new
      dsl.name name unless name.nil?
      if [-1, 0].include? block.arity
        dsl.instance_eval(&block)
      else
        yield(dsl)
      end

      # Create command
      cmd = dsl.command
      add_command(cmd)
      cmd
    end
928657
def get_command(self, name):
        
        name = adapt_name_for_rest(name)
        url = '/mdb/{}/commands{}'.format(self._instance, name)
        response = self._client.get_proto(url)
        message = mdb_pb2.CommandInfo()
        message.ParseFromString(response.content)
        return Command(message)
826400
def call_command(self, cmd, *argv):
        
        parser = self.get_parser()
        args = [cmd] + list(argv)
        namespace = parser.parse_args(args)
        self.run_command(namespace)