public static CommandModel CreateCommandModel() { var model = new CommandModel(); model.Command("install") .Parameter <string>((m, v) => m.Parameters.Add(v)) .Execute(RunInstall); model.Command("uninstall") .Parameter <string>((m, v) => m.Parameters.Add(v)) .Execute(RunUninstall); model.Command("{run server}", EndingWithExe, (m, v) => m.Set(v)) .Option <StartOptions, int>("port", (m, v) => m.Port = v) .Option <StartOptions, string>("path", (m, v) => m.Settings["directory"] = v) .Option <StartOptions, string>("vpath", (m, v) => { }) .Execute <StartOptions, int>(RunWebApplication); return(model); }
public static CommandModel CreateCommandModel() { var model = new CommandModel(); // run this alternate command for any help-like parameter model.Command("{show help}", IsHelpOption, (m, v) => { }).Execute(ShowHelp); // otherwise use these switches model.Option <StartOptions, string>( "server", "s", Resources.ProgramOutput_ServerOption, (options, value) => options.ServerFactory = value); model.Option <StartOptions, string>( "url", "u", Resources.ProgramOutput_UriOption, (options, value) => options.Urls.Add(value)); model.Option <StartOptions, int>( "port", "p", Resources.ProgramOutput_PortOption, (options, value) => options.Port = value); model.Option <StartOptions, string>( "directory", "d", Resources.ProgramOutput_DirectoryOption, (options, value) => options.Settings["directory"] = value); model.Option <StartOptions, string>( "traceoutput", "o", Resources.ProgramOutput_OutputOption, (options, value) => options.Settings["traceoutput"] = value); model.Option <StartOptions, string>( "settings", Resources.ProgramOutput_SettingsOption, LoadSettings); model.Option <StartOptions, string>( "boot", "b", Resources.ProgramOutput_BootOption, (options, value) => options.Settings["boot"] = value); /* Disabled until we need to consume it anywhere. * model.Option<StartOptions, string>( * "verbosity", "v", "Set output verbosity level.", * (options, value) => options.Settings["traceverbosity"] = value); */ // and take the name of the application startup model.Parameter <string>((cmd, value) => { var options = cmd.Get <StartOptions>(); if (options.AppStartup == null) { options.AppStartup = value; } else { options.AppStartup += " " + value; } }); // to call this action model.Execute <StartOptions>(RunServer); return(model); }
public CommandModel CreateCommandModel() { var model = new CommandModel(); // run this alternate command for any help-like parameter model.Command("{show help}", IsHelpOption, (m, v) => { }).Execute(ShowHelp); // otherwise use these switches model.Option<StartOptions, string>( "server", "s", Resources.ProgramOutput_ServerOption, (options, value) => options.ServerFactory = value); model.Option<StartOptions, string>( "url", "u", Resources.ProgramOutput_UriOption, (options, value) => options.Urls.Add(value)); model.Option<StartOptions, int>( "port", "p", Resources.ProgramOutput_PortOption, (options, value) => options.Port = value); model.Option<StartOptions, string>( "directory", "d", Resources.ProgramOutput_DirectoryOption, (options, value) => options.Settings["directory"] = value); model.Option<StartOptions, string>( "traceoutput", "o", Resources.ProgramOutput_OutputOption, (options, value) => options.Settings["traceoutput"] = value); model.Option<StartOptions, string>( "settings", Resources.ProgramOutput_SettingsOption, LoadSettings); model.Option<StartOptions, string>( "boot", "b", Resources.ProgramOutput_BootOption, (options, value) => options.Settings["boot"] = value); model.Option<StartOptions, int>( "devMode", "dev", Resources.ProgramOutput_DevModeOption, (options, value) => options.Settings["devMode"] = value.ToString()); /* Disabled until we need to consume it anywhere. model.Option<StartOptions, string>( "verbosity", "v", "Set output verbosity level.", (options, value) => options.Settings["traceverbosity"] = value); */ // and take the name of the application startup model.Parameter<string>((cmd, value) => { var options = cmd.Get<StartOptions>(); if (options.AppStartup == null) { options.AppStartup = value; } else { options.AppStartup += " " + value; } }); // to call this action model.Execute<StartOptions>(RunServer); return model; }
public static CommandModel CreateCommandModel() { var model = new CommandModel(); model.Command("install") .Parameter<string>((m, v) => m.Parameters.Add(v)) .Execute(RunInstall); model.Command("uninstall") .Parameter<string>((m, v) => m.Parameters.Add(v)) .Execute(RunUninstall); model.Command("{run server}", EndingWithExe, (m, v) => m.Set(v)) .Option<StartOptions, int>("port", (m, v) => m.Port = v) .Option<StartOptions, string>("path", (m, v) => m.Settings["directory"] = v) .Option<StartOptions, string>("vpath", (m, v) => { }) .Execute<StartOptions, int>(RunWebApplication); return model; }