Beispiel #1
0
        public static int Run(string[] args)
        {
            DebugHelper.HandleDebugSwitch(ref args);

            CommandLineApplication app = new CommandLineApplication(throwOnUnexpectedArg: false);

            app.Name                   = "dotnet run3";
            app.FullName               = ".NET Run3 Command";
            app.Description            = "Command used to run .NET apps";
            app.HandleResponseFiles    = true;
            app.AllowArgumentSeparator = true;
            app.HelpOption("-h|--help");

            CommandOption configuration = app.Option("-c|--configuration", "Configuration under which to build", CommandOptionType.SingleValue);
            CommandOption project       = app.Option("-p|--project", "The path to the project file to run (defaults to the current directory if there is only one project).", CommandOptionType.SingleValue);

            app.OnExecute(() =>
            {
                Run3Command runCmd = new Run3Command();

                runCmd.Configuration = configuration.Value();
                runCmd.Project       = project.Value();
                runCmd.Args          = app.RemainingArguments;

                return(runCmd.Start());
            });

            return(app.Execute(args));
        }
Beispiel #2
0
        public static int Run(string[] args)
        {
            DebugHelper.HandleDebugSwitch(ref args);

            CommandLineApplication app = new CommandLineApplication(throwOnUnexpectedArg: false);

            app.Name                      = "dotnet run3";
            app.FullName                  = ".NET Run3 Command";
            app.Description               = "Command used to run .NET apps";
            app.HandleResponseFiles       = true;
            app.AllowArgumentSeparator    = true;
            app.ArgumentSeparatorHelpText = HelpMessageStrings.MSBuildAdditionalArgsHelpText;
            app.HelpOption("-h|--help");

            CommandOption configuration = app.Option(
                "-c|--configuration", "Configuration under which to build",
                CommandOptionType.SingleValue);
            CommandOption framework = app.Option(
                "-f|--framework <FRAMEWORK>", "Compile a specific framework",
                CommandOptionType.SingleValue);
            CommandOption noBuild = app.Option(
                "--no-build", "Do not build the project before running.",
                CommandOptionType.BoolValue);
            CommandOption project = app.Option(
                "-p|--project", "The path to the project file to run (defaults to the current directory if there is only one project).",
                CommandOptionType.SingleValue);

            app.OnExecute(() =>
            {
                Run3Command runCmd = new Run3Command();

                runCmd.Configuration = configuration.Value();
                runCmd.Framework     = framework.Value();
                runCmd.NoBuild       = noBuild.BoolValue ?? false;
                runCmd.Project       = project.Value();
                runCmd.Args          = app.RemainingArguments;

                return(runCmd.Start());
            });

            return(app.Execute(args));
        }