private static IConfigurator ConfigureCommands(IConfigurator config) { config.CaseSensitivity(CaseSensitivity.None); config.SetApplicationName("witsml-cli"); config.AddBranch("list", add => { add.AddCommand <ListWellboresCommand>("wellbores").WithDescription("List active wellbores"); add.AddCommand <ListLogsCommand>("logs").WithDescription("List logs within a well/wellbore"); add.AddCommand <ListBhaRunsCommand>("bharuns").WithDescription("List bha runs within a well/wellbore"); add.AddCommand <ListTubularsCommand>("tubulars").WithDescription("List tubulars within a well/wellbore"); add.AddCommand <ListRisksCommand>("risks").WithDescription("List risks"); }); config.AddBranch("show", add => { add.AddCommand <ShowTubularCommand>("tubular").WithDescription("Export tubular within a well/wellbore"); add.AddCommand <ShowLogHeaderCommand>("log").WithDescription("Show a log header"); }); config.AddBranch("query", add => { add.AddCommand <GetQueryCommand>("get").WithDescription("Execute GET query"); }); return(config); }
public void ConfigureCommand(IConfigurator configurator) { // TODO: tie discovery to JSON configurator.AddBranch <DomainBranchSettings>("domain", domain => { domain.AddCommand <StartCommand>("start"); }); }
/// <summary> /// Adds a command branch. /// </summary> /// <param name="configurator">The configurator.</param> /// <param name="name">The name of the command branch.</param> /// <param name="action">The command branch configuration.</param> public static void AddBranch( this IConfigurator configurator, string name, Action <IConfigurator <CommandSettings> > action) { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } configurator.AddBranch(name, action); }
private static void ConfigureGenerateClientCommands( IConfigurator <CommandSettings> node) => node.AddBranch(NameCommandConstants.GenerateClient, client => { client.SetDescription("Operations related to generating client project(s)."); client.AddCommand <GenerateClientCSharpCommand>(NameCommandConstants.GenerateClientCsharp) .WithDescription("Generate client project in C#.") .WithExample(new[] { NameCommandConstants.Generate, NameCommandConstants.GenerateClient, NameCommandConstants.GenerateClientCsharp, CreateArgumentConfigurationSpecificationPath(), }); });
private static void ConfigureGenerateServerCommands( IConfigurator <CommandSettings> node) => node.AddBranch(NameCommandConstants.GenerateServer, client => { client.SetDescription("Operations related to generating server project(s)."); client.AddCommand <GenerateServerAllCommand>(NameCommandConstants.GenerateServerAll) .WithDescription("Creates API, domain and host projects.") .WithExample(new[] { NameCommandConstants.Generate, NameCommandConstants.GenerateServer, CreateArgumentConfigurationSpecificationPath(), CreateArgumentProjectPrefixName(), ".", }) .WithExample(new[] { NameCommandConstants.Generate, NameCommandConstants.GenerateServer, NameCommandConstants.GenerateServerAll, CreateArgumentConfigurationSpecificationPath(), CreateArgumentProjectPrefixName(), ".", }) .WithExample(new[] { NameCommandConstants.Generate, NameCommandConstants.GenerateServer, NameCommandConstants.GenerateServerAll, CreateArgumentConfigurationSpecificationPath(), CreateArgumentProjectPrefixName(), CreateArgumentConfigurationOutputSolutionPath(), CreateArgumentConfigurationSourcePath(), }); client.AddCommand <GenerateServerApiCommand>(NameCommandConstants.GenerateServerApi) .WithDescription("Create API project.") .WithExample(new[] { NameCommandConstants.Generate, NameCommandConstants.GenerateServer, NameCommandConstants.GenerateServerApi, CreateArgumentConfigurationSpecificationPath(), CreateArgumentProjectPrefixName(), CreateArgumentConfigurationOutputPath(), }); client.AddCommand <GenerateServerDomainCommand>(NameCommandConstants.GenerateServerDomain) .WithDescription("Create domain project (requires API project).") .WithExample(new[] { NameCommandConstants.Generate, NameCommandConstants.GenerateServer, NameCommandConstants.GenerateServerDomain, CreateArgumentConfigurationSpecificationPath(), CreateArgumentProjectPrefixName(), CreateArgumentConfigurationOutputPath(), }); client.AddCommand <GenerateServerHostCommand>(NameCommandConstants.GenerateServerHost) .WithDescription("Create ASP.NET Core host project (requires API and domain projects).") .WithExample(new[] { NameCommandConstants.Generate, NameCommandConstants.GenerateServer, NameCommandConstants.GenerateServerHost, CreateArgumentConfigurationSpecificationPath(), CreateArgumentProjectPrefixName(), CreateArgumentConfigurationOutputPath(), CreateArgumentConfigurationApiPath(), CreateArgumentConfigurationDomainPath(), }); });