7b0b9c7365
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
50 lines
3.0 KiB
C#
50 lines
3.0 KiB
C#
using System.CommandLine;
|
|
using System.CommandLine.Parsing;
|
|
using ZB.MOM.WW.ScadaBridge.CLI.Commands;
|
|
|
|
var rootCommand = new RootCommand("ScadaBridge CLI — manage the ScadaBridge SCADA system");
|
|
|
|
var urlOption = new Option<string>("--url") { Description = "Management API URL", Recursive = true };
|
|
var usernameOption = new Option<string>("--username") { Description = "LDAP username", Recursive = true };
|
|
var passwordOption = new Option<string>("--password") { Description = "LDAP password", Recursive = true };
|
|
// No DefaultValueFactory: format precedence (explicit --format -> config/env -> "json")
|
|
// is resolved by CommandHelpers.ResolveFormat, which needs to distinguish an absent flag.
|
|
// CliOptions.CreateFormatOption also constrains the accepted values (json/table).
|
|
var formatOption = CliOptions.CreateFormatOption();
|
|
|
|
rootCommand.Add(urlOption);
|
|
rootCommand.Add(usernameOption);
|
|
rootCommand.Add(passwordOption);
|
|
rootCommand.Add(formatOption);
|
|
|
|
// Register command groups
|
|
rootCommand.Add(TemplateCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(InstanceCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(SiteCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(DeployCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(DataConnectionCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(ExternalSystemCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(NotificationCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(SecurityCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(AuditLogCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(AuditCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(HealthCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(DebugCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(SharedScriptCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(DbConnectionCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(ApiMethodCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
rootCommand.Add(BundleCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
|
|
|
rootCommand.SetAction(_ =>
|
|
{
|
|
Console.WriteLine("Use --help to see available commands.");
|
|
});
|
|
|
|
// Deprecation notice for the pre-M8 `audit-log` command name. The command itself
|
|
// still works (it is an alias of `audit-config`), but using the old name emits a
|
|
// warning to stderr so scripts can be migrated.
|
|
AuditLogCommands.WriteDeprecationWarningIfNeeded(args, Console.Error);
|
|
|
|
var parseResult = CommandLineParser.Parse(rootCommand, args);
|
|
return await parseResult.InvokeAsync();
|