예제 #1
0
        public static Command Create(
            ICommandResolverPolicy commandResolverPolicy,
            string commandName,
            IEnumerable <string> args,
            NuGetFramework framework = null,
            string configuration     = Constants.DefaultConfiguration,
            string outputPath        = null,
            string applicationName   = null)
        {
            var commandSpec = CommandResolver.TryResolveCommandSpec(
                commandResolverPolicy,
                commandName,
                args,
                framework,
                configuration: configuration,
                outputPath: outputPath,
                applicationName: applicationName);

            if (commandSpec == null)
            {
                throw new CommandUnknownException(commandName);
            }

            var command = new Command(commandSpec);

            return(command);
        }
예제 #2
0
        public static Command Create(
            ICommandResolverPolicy commandResolverPolicy,
            string commandName,
            IEnumerable <string> args,
            NuGetFramework framework = null,
            string configuration     = Constants.DefaultConfiguration,
            string outputPath        = null,
            string applicationName   = null)
        {
            var commandSpec = CommandResolver.TryResolveCommandSpec(
                commandResolverPolicy,
                commandName,
                args,
                framework,
                configuration: configuration,
                outputPath: outputPath,
                applicationName: applicationName);

            if (commandSpec == null)
            {
                if (_knownCommandsAvailableAsDotNetTool.Contains(commandName, StringComparer.OrdinalIgnoreCase))
                {
                    throw new CommandAvailableAsDotNetToolException(commandName);
                }
                else
                {
                    throw new CommandUnknownException(commandName);
                }
            }

            var command = new Command(commandSpec);

            return(command);
        }
예제 #3
0
파일: Command.cs 프로젝트: swgillespie/cli
        public static Command Create(string commandName, string args, NuGetFramework framework = null)
        {
            var commandSpec = CommandResolver.TryResolveCommandSpec(commandName, args, framework);

            if (commandSpec == null)
            {
                throw new CommandUnknownException(commandName);
            }

            var command = new Command(commandSpec);

            return(command);
        }
예제 #4
0
        /// <summary>
        /// Create a command with the specified arg array. Args will be
        /// escaped properly to ensure that exactly the strings in this
        /// array will be present in the corresponding argument array
        /// in the command's process.
        /// </summary>
        /// <param name="commandName"></param>
        /// <param name="args"></param>
        /// <param name="framework"></param>
        /// <returns></returns>
        public static Command Create(string commandName, IEnumerable <string> args, NuGetFramework framework = null, bool useComSpec = false)
        {
            var commandSpec = CommandResolver.TryResolveCommandSpec(commandName, args, framework, useComSpec);

            if (commandSpec == null)
            {
                throw new CommandUnknownException(commandName);
            }

            var command = new Command(commandSpec);

            return(command);
        }
예제 #5
0
        public static Command CreateForScript(
            string commandName,
            IEnumerable <string> args,
            Project project,
            string[] inferredExtensionList)
        {
            var commandSpec = CommandResolver.TryResolveScriptCommandSpec(commandName,
                                                                          args,
                                                                          project,
                                                                          inferredExtensionList);

            if (commandSpec == null)
            {
                throw new CommandUnknownException(commandName);
            }

            var command = new Command(commandSpec);

            return(command);
        }
예제 #6
0
        /// <summary>
        /// Create a command with the specified arg array. Args will be
        /// escaped properly to ensure that exactly the strings in this
        /// array will be present in the corresponding argument array
        /// in the command's process.
        /// </summary>
        /// <param name="commandName"></param>
        /// <param name="args"></param>
        /// <param name="framework"></param>
        /// <returns></returns>
        public static Command Create(
            string commandName,
            IEnumerable <string> args,
            NuGetFramework framework = null,
            string configuration     = Constants.DefaultConfiguration)
        {
            var commandSpec = CommandResolver.TryResolveCommandSpec(commandName,
                                                                    args,
                                                                    framework,
                                                                    configuration: configuration);

            if (commandSpec == null)
            {
                throw new CommandUnknownException(commandName);
            }

            var command = new Command(commandSpec);

            return(command);
        }