Closed dark0dave closed 1 week ago
I have trialled a solution that works.
Instead of a string value for Config.Output, we can have a OutputFormat type that implements pflag.Value to enforce strict string matching during flag parsing. Then we use VarP instead of StringVarP to register the value that will automatically validate the flag.
I am ready to submit a PR. What do you think?
@harry97uk please submit a pr, I think its an excellent solution.
Currently we check in config and printer for the printer type text,csv, or json. Ideally we do this once. The pflag library is alittle lacking when it comes to exact strings so this is alittle annoying. I am open to suggestions here.