using System.CommandLine; using System.CommandLine.Parsing; using ScadaLink.CLI.Commands; var rootCommand = new RootCommand("ScadaLink CLI — manage the ScadaLink SCADA system"); var urlOption = new Option("--url") { Description = "Management API URL", Recursive = true }; var usernameOption = new Option("--username") { Description = "LDAP username", Recursive = true }; var passwordOption = new Option("--password") { Description = "LDAP password", Recursive = true }; var formatOption = new Option("--format") { Description = "Output format (json or table)", Recursive = true }; formatOption.DefaultValueFactory = _ => "json"; 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(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.SetAction(_ => { Console.WriteLine("Use --help to see available commands."); }); var parseResult = CommandLineParser.Parse(rootCommand, args); return await parseResult.InvokeAsync();