예제 #1
0
파일: Parser.cs 프로젝트: mattimus-run/sdk
            public override void Write(ICommand command)
            {
                var helpArgs = new string[] { "--help" };

                if (command.Equals(RootCommand))
                {
                    Console.Out.WriteLine(HelpUsageText.UsageText);
                }
                else if (command.Name.Equals(NuGetCommandParser.GetCommand().Name))
                {
                    NuGetCommand.Run(helpArgs);
                }
                else if (command.Name.Equals(MSBuildCommandParser.GetCommand().Name))
                {
                    new MSBuildForwardingApp(helpArgs).Execute();
                }
                else if (command.Name.Equals(NewCommandParser.GetCommand().Name))
                {
                    NewCommandShim.Run(helpArgs);
                }
                else if (command.Name.Equals(VSTestCommandParser.GetCommand().Name))
                {
                    new VSTestForwardingApp(helpArgs).Execute();
                }
                else
                {
                    if (command.Name.Equals(ListProjectToProjectReferencesCommandParser.GetCommand().Name))
                    {
                        ListCommandParser.SlnOrProjectArgument.Name        = CommonLocalizableStrings.ProjectArgumentName;
                        ListCommandParser.SlnOrProjectArgument.Description = CommonLocalizableStrings.ProjectArgumentDescription;
                    }

                    base.Write(command);
                }
            }
예제 #2
0
            public override void Write(HelpContext context)
            {
                var command  = context.Command;
                var helpArgs = new string[] { "--help" };

                if (command.Equals(RootCommand))
                {
                    Console.Out.WriteLine(HelpUsageText.UsageText);
                }
                else if (command.Name.Equals(NuGetCommandParser.GetCommand().Name))
                {
                    NuGetCommand.Run(helpArgs);
                }
                else if (command.Name.Equals(MSBuildCommandParser.GetCommand().Name))
                {
                    new MSBuildForwardingApp(helpArgs).Execute();
                }
                else if (command.Name.Equals(NewCommandParser.GetCommand().Name))
                {
                    NewCommandShim.Run(helpArgs);
                }
                else if (command.Name.Equals(VSTestCommandParser.GetCommand().Name))
                {
                    new VSTestForwardingApp(helpArgs).Execute();
                }
                else
                {
                    if (command.Name.Equals(ListProjectToProjectReferencesCommandParser.GetCommand().Name))
                    {
                        ListCommandParser.SlnOrProjectArgument.Name        = CommonLocalizableStrings.ProjectArgumentName;
                        ListCommandParser.SlnOrProjectArgument.Description = CommonLocalizableStrings.ProjectArgumentDescription;
                    }
                    else if (command.Name.Equals(AddPackageParser.GetCommand().Name) || command.Name.Equals(AddCommandParser.GetCommand().Name))
                    {
                        // Don't show package suggestions in help
                        AddPackageParser.CmdPackageArgument.Suggestions.Clear();
                    }

                    base.Write(context);
                }
            }
예제 #3
0
        private static Command ConstructCommand()
        {
            var command = new DocumentedCommand("new", DocsLink);

            command.AddArgument(Argument);
            command.AddOption(ListOption);
            command.AddOption(NameOption);
            command.AddOption(OutputOption);
            command.AddOption(InstallOption);
            command.AddOption(UninstallOption);
            command.AddOption(InteractiveOption);
            command.AddOption(NuGetSourceOption);
            command.AddOption(TypeOption);
            command.AddOption(DryRunOption);
            command.AddOption(ForceOption);
            command.AddOption(LanguageOption);
            command.AddOption(UpdateCheckOption);
            command.AddOption(UpdateApplyOption);
            command.AddOption(ColumnsOption);

            command.Handler = CommandHandler.Create <ParseResult>((ParseResult parseResult) => NewCommandShim.Run(parseResult.GetArguments()));

            return(command);
        }