Qiita::CommandBuilder.new(argv)
 Creates a new instance of Qiita::CommandBuilder from given command line arguments.

 Qiita::CommandBuilder#call
 Returns a new instance of command class that inherited from Qiita::Commands::Base.
489139
def call
      if arguments.valid?
        Qiita::Commands::Request.new(arguments)
      else
        Qiita::Commands::Error.new(arguments)
      end
    end
396802
function _new (args) {
    // instantiate new instance
    var instance = new ImmutableCoreComponentInstance({
        args: args,
        component: this,
    })
    // wait for initialize promise to resolve then resolve with instance
    return instance.promise.then(() => instance)
}
646613
public T newInstance(Object... args) throws Throwable
    {
        Constructor<? extends T> constructor = ClassUtils.findBestTypedConstructor(klass, args);
        return ClassUtils.invoke(constructor, args);
    }
746869
private function createFromCommand()
    {
        $command = BranchCommand::getInstance($this->getRepository())->listBranches();
        $outputLines = $this->repository->getCaller()->execute($command)->getOutputLines(true);
        foreach ($outputLines as $outputLine) {
            $matches = static::getMatches($outputLine);

            if ($this->name === $matches[1]) {
                $this->parseOutputLine($outputLine);

                return;
            }
        }

        throw new InvalidBranchNameException(sprintf('The %s branch doesn\'t exists', $this->name));
    }
501980
public T newInstanceUsingCoercion(String... args) throws Throwable
    {
        Constructor<? extends T> constructor = ClassUtils.findPossibleConstructor(klass, args);
        Class[] types = constructor.getParameterTypes();
        return newInstance( TypeConversion.convert( args, types ) );
    }
696062
def _new_java_obj(sc, java_class, *args):
    
    java_obj = _jvm()
    for name in java_class.split("."):
        java_obj = getattr(java_obj, name)
    java_args = [_py2java(sc, arg) for arg in args]
    return java_obj(*java_args)
389350
public T newInstance(Object... args)
    {
        try
        {
            return type.cast(factoryMethod.invoke(null, args));
        }
        catch (IllegalAccessException e)
        {
            throw ExceptionImposter.imposterize( e );
        }
        catch (InvocationTargetException e)
        {
            throw ExceptionImposter.imposterize( e.getCause() );
        }
    }
935587
private function createFromCommand()
    {
        $command = LsTreeCommand::getInstance($this->getRepository())->tree($this->ref, $this->subject);
        $outputLines = $this->getCaller()->execute($command)->getOutputLines(true);
        $this->parseOutputLines($outputLines);
    }
224184
@SuppressWarnings("static-method")
	protected BQRuntime createRuntime(String... args) {
		SARLStandaloneSetup.doPreSetup();
		final BQRuntime runtime = Bootique.app(args).autoLoadModules().createRuntime();
		SARLStandaloneSetup.doPostSetup(runtime.getInstance(Injector.class));
		return runtime;
	}
349610
def new(self, *args, **kwargs) -> str:
        
        args = list(args)

        data = [self.prefix]

        for part in self._part_names:
            value = kwargs.pop(part, None)
            if value is None:
                if args:
                    value = args.pop(0)
                else:
                    raise ValueError(f"Value for '{part}' is not passed!")

            if value is not None and not isinstance(value, str):
                value = str(value)

            if not value:
                raise ValueError(f"Value for part {part} can't be empty!'")
            elif self.sep in value:
                raise ValueError(f"Symbol defined as separator can't be used in values of parts")

            data.append(value)

        if args or kwargs:
            raise TypeError('Too many arguments is passed!')

        callback_data = self.sep.join(data)
        if len(callback_data) > 64:
            raise ValueError('Resulted callback data is too long!')

        return callback_data
775644
def new_parser(self):
        

        parser = argparse.ArgumentParser(description=self.description)
        parser.add_argument(
            '--version', help='show version and exit',
            default=False, action='store_true')
        parser.add_argument(
            '--debug', help='enable debugging',
            default=False, action='store_true')
        return parser
94705
def tarbell_newproject(command, args):
    
    with ensure_settings(command, args) as settings:
        # Set it up and make the directory
        name = _get_project_name(args)
        puts("Creating {0}".format(colored.cyan(name)))
        path = _get_path(name, settings)
        _mkdir(path)

        try:
            _newproject(command, path, name, settings)
        except KeyboardInterrupt:
            _delete_dir(path)
            show_error("ctrl-c pressed, not creating new project.")
        except:
            _delete_dir(path)
            show_error("Unexpected error: {0}".format(sys.exc_info()[0]))
            raise
557925
def run_from_argv(self, argv):
        
        if (len(argv) > 2 and not argv[2].startswith('-') and
                argv[2] in self.subcommands.keys()):
            subcommand = argv[2]
            klass = self.get_subcommand(subcommand)
            parser = OptionParser(
                prog=argv[0],
                usage=klass.usage('{0} {1}'.format(argv[1], subcommand)),
                version=klass.get_version(), option_list=klass.option_list)
            options, args = parser.parse_args(argv[3:])
            args = [subcommand] + args
        else:
            parser = self.create_parser(argv[0], argv[1])
            options, args = parser.parse_args(argv[2:])

        handle_default_options(options)
        self.execute(*args, **options.__dict__)
1353898
def create_cmd(self, args):
        '''
        
        '''
        cmd = args.get('cmd_create')
        if cmd == 'conf':
            conf_file = args['conf_file']
            conf_id = args['id']
            return self.load_xml_conf(conf_file, conf_id)
        else:
            print("Error: Create %s is invalid or not implemented" % cmd)
994491
def _make_command_method(cls, command_name):
        
        def func(self, *args, **kwargs):
            return self._call_command(command_name, *args, **kwargs)
        return func
1180114
private Commandline _createCommandLine ()
  {
    /*
     * NOTE: This method is designed to work with plexus-utils:1.1 which is used
     * by all Maven versions before 2.0.6 regardless of our plugin dependency.
     * Therefore, we use setWorkingDirectory(String) rather than
     * setWorkingDirectory(File) and addArguments() rather than createArg().
     */

    final Commandline cli = new Commandline ();

    cli.setExecutable (this.executable);

    if (this.workingDirectory != null)
    {
      cli.setWorkingDirectory (this.workingDirectory.getAbsolutePath ());
    }

    final String classPath = _getClassPath ();
    if (classPath != null && classPath.length () > 0)
    {
      cli.addArguments (new String [] { "-cp", classPath });
    }

    if (this.mainClass != null && this.mainClass.length () > 0)
    {
      cli.addArguments (new String [] { this.mainClass });
    }

    cli.addArguments (_getArguments ());

    return cli;
  }
795451
def __create_command(self, deviceimpl_class, cmd_name, cmd_info):
    """"""
    name = self.get_name()

    # check for well defined command info

    # check parameter
    if not isinstance(cmd_info, collections_abc.Sequence):
        msg = "Wrong data type for value for describing command %s in " \
              "class %s\nMust be a sequence with 2 or 3 elements" % (cmd_name, name)
        __throw_create_command_exception(msg)

    if len(cmd_info) < 2 or len(cmd_info) > 3:
        msg = "Wrong number of argument for describing command %s in " \
              "class %s\nMust be a sequence with 2 or 3 elements" % (cmd_name, name)
        __throw_create_command_exception(msg)

    param_info, result_info = cmd_info[0], cmd_info[1]

    if not isinstance(param_info, collections_abc.Sequence):
        msg = "Wrong data type in command argument for command %s in " \
              "class %s\nCommand parameter (first element) must be a sequence" % (cmd_name, name)
        __throw_create_command_exception(msg)

    if len(param_info) < 1 or len(param_info) > 2:
        msg = "Wrong data type in command argument for command %s in " \
              "class %s\nSequence describing command parameters must contain " \
              "1 or 2 elements"
        __throw_create_command_exception(msg)

    param_type = CmdArgType.DevVoid
    try:
        param_type = CmdArgType(param_info[0])
    except:
        msg = "Wrong data type in command argument for command %s in " \
              "class %s\nCommand parameter type (first element in first " \
              "sequence) must be a tango.CmdArgType"
        __throw_create_command_exception(msg)

    param_desc = ""
    if len(param_info) > 1:
        param_desc = param_info[1]
        if not is_pure_str(param_desc):
            msg = "Wrong data type in command parameter for command %s in " \
                  "class %s\nCommand parameter description (second element " \
                  "in first sequence), when given, must be a string"
            __throw_create_command_exception(msg)

    # Check result
    if not isinstance(result_info, collections_abc.Sequence):
        msg = "Wrong data type in command result for command %s in " \
              "class %s\nCommand result (second element) must be a sequence" % (cmd_name, name)
        __throw_create_command_exception(msg)

    if len(result_info) < 1 or len(result_info) > 2:
        msg = "Wrong data type in command result for command %s in " \
              "class %s\nSequence describing command result must contain " \
              "1 or 2 elements" % (cmd_name, name)
        __throw_create_command_exception(msg)

    result_type = CmdArgType.DevVoid
    try:
        result_type = CmdArgType(result_info[0])
    except:
        msg = "Wrong data type in command result for command %s in " \
              "class %s\nCommand result type (first element in second " \
              "sequence) must be a tango.CmdArgType" % (cmd_name, name)
        __throw_create_command_exception(msg)

    result_desc = ""
    if len(result_info) > 1:
        result_desc = result_info[1]
        if not is_pure_str(result_desc):
            msg = "Wrong data type in command result for command %s in " \
                  "class %s\nCommand parameter description (second element " \
                  "in second sequence), when given, must be a string" % (cmd_name, name)
            __throw_create_command_exception(msg)

    # If it is defined, get addictional dictionnary used for optional parameters
    display_level, default_command, polling_period = DispLevel.OPERATOR, False, -1

    if len(cmd_info) == 3:
        extra_info = cmd_info[2]
        if not isinstance(extra_info, collections_abc.Mapping):
            msg = "Wrong data type in command information for command %s in " \
                  "class %s\nCommand information (third element in sequence), " \
                  "when given, must be a dictionary" % (cmd_name, name)
            __throw_create_command_exception(msg)

        if len(extra_info) > 3:
            msg = "Wrong data type in command information for command %s in " \
                  "class %s\nThe optional dictionary can not have more than " \
                  "three elements" % (cmd_name, name)
            __throw_create_command_exception(msg)

        for info_name, info_value in extra_info.items():
            info_name_lower = info_name.lower()
            if info_name_lower == "display level":
                try:
                    display_level = DispLevel(info_value)
                except:
                    msg = "Wrong data type in command information for command %s in " \
                          "class %s\nCommand information for display level is not a " \
                          "tango.DispLevel" % (cmd_name, name)
                    __throw_create_command_exception(msg)
            elif info_name_lower == "default command":
                if not is_pure_str(info_value):
                    msg = "Wrong data type in command information for command %s in " \
                          "class %s\nCommand information for default command is not a " \
                          "string" % (cmd_name, name)
                    __throw_create_command_exception(msg)
                v = info_value.lower()
                default_command = v == 'true'
            elif info_name_lower == "polling period":
                try:
                    polling_period = int(info_value)
                except:
                    msg = "Wrong data type in command information for command %s in " \
                          "class %s\nCommand information for polling period is not an " \
                          "integer" % (cmd_name, name)
                    __throw_create_command_exception(msg)
            else:
                msg = "Wrong data type in command information for command %s in " \
                      "class %s\nCommand information has unknown key " \
                      "%s" % (cmd_name, name, info_name)
                __throw_create_command_exception(msg)

    # check that the method to be executed exists
    try:
        cmd = getattr(deviceimpl_class, cmd_name)
        if not isinstance(cmd, collections_abc.Callable):
            msg = "Wrong definition of command %s in " \
                  "class %s\nThe object exists in class but is not " \
                  "a method!" % (cmd_name, name)
            __throw_create_command_exception(msg)
    except AttributeError:
        msg = "Wrong definition of command %s in " \
              "class %s\nThe command method does not exist!" % (cmd_name, name)
        __throw_create_command_exception(msg)

    is_allowed_name = "is_%s_allowed" % cmd_name
    try:
        is_allowed = getattr(deviceimpl_class, is_allowed_name)
        if not isinstance(is_allowed, collections_abc.Callable):
            msg = "Wrong definition of command %s in " \
                  "class %s\nThe object '%s' exists in class but is " \
                  "not a method!" % (cmd_name, name, is_allowed_name)
            __throw_create_command_exception(msg)
    except:
        is_allowed_name = ""

    self._create_command(cmd_name, param_type, result_type,
                         param_desc, result_desc,
                         display_level, default_command,
                         polling_period, is_allowed_name)