Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
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);
        }