using System.CommandLine; namespace ScadaLink.CLI.Commands; /// /// Factory methods for the global CLI options. Centralising option construction keeps /// validation rules (e.g. the accepted --format values) in one place and makes /// them testable without standing up the whole command tree. /// internal static class CliOptions { /// /// Creates the global --format option. The option deliberately has no /// DefaultValueFactory — format precedence (explicit flag → config/env → /// "json") is resolved by , which /// needs to distinguish an absent flag. The accepted values are constrained so a /// typo (e.g. --format tabel) is rejected with a clear parse error rather /// than silently falling through to JSON. /// internal static Option CreateFormatOption() { var formatOption = new Option("--format") { Description = "Output format (json or table)", Recursive = true, }; formatOption.AcceptOnlyFromAmong("json", "table"); return formatOption; } }