37 lines
1.8 KiB
C#
37 lines
1.8 KiB
C#
using System.CommandLine;
|
|
using System.CommandLine.Parsing;
|
|
using ScadaLink.CLI.Commands;
|
|
|
|
var rootCommand = new RootCommand("ScadaLink CLI — manage the ScadaLink SCADA system");
|
|
|
|
var contactPointsOption = new Option<string>("--contact-points") { Description = "Comma-separated cluster contact points", Recursive = true };
|
|
var usernameOption = new Option<string>("--username") { Description = "LDAP username", Recursive = true };
|
|
var passwordOption = new Option<string>("--password") { Description = "LDAP password", Recursive = true };
|
|
var formatOption = new Option<string>("--format") { Description = "Output format (json or table)", Recursive = true };
|
|
formatOption.DefaultValueFactory = _ => "json";
|
|
|
|
rootCommand.Add(contactPointsOption);
|
|
rootCommand.Add(usernameOption);
|
|
rootCommand.Add(passwordOption);
|
|
rootCommand.Add(formatOption);
|
|
|
|
// Register command groups
|
|
rootCommand.Add(TemplateCommands.Build(contactPointsOption, formatOption));
|
|
rootCommand.Add(InstanceCommands.Build(contactPointsOption, formatOption));
|
|
rootCommand.Add(SiteCommands.Build(contactPointsOption, formatOption));
|
|
rootCommand.Add(DeployCommands.Build(contactPointsOption, formatOption));
|
|
rootCommand.Add(DataConnectionCommands.Build(contactPointsOption, formatOption));
|
|
rootCommand.Add(ExternalSystemCommands.Build(contactPointsOption, formatOption));
|
|
rootCommand.Add(NotificationCommands.Build(contactPointsOption, formatOption));
|
|
rootCommand.Add(SecurityCommands.Build(contactPointsOption, formatOption));
|
|
rootCommand.Add(AuditLogCommands.Build(contactPointsOption, formatOption));
|
|
rootCommand.Add(HealthCommands.Build(contactPointsOption, formatOption));
|
|
|
|
rootCommand.SetAction(_ =>
|
|
{
|
|
Console.WriteLine("Use --help to see available commands.");
|
|
});
|
|
|
|
var parseResult = CommandLineParser.Parse(rootCommand, args);
|
|
return await parseResult.InvokeAsync();
|