corectl
corectl copied to clipboard
Display error when passing invalid flags
If I pass an invalid flag like this:
corectl -c corectlconf.yaml eval "Count([Name/Alias])" --traffic --json
--json is invalid.
This will then return the same value as this command:
corectl -c corectlconf.yaml eval "Count([Name/Alias])"
In my conf file I've specified engine, header and app.
Actually --json
is a global flag and can be passed to all commands, so it is still a valid flag for the eval
command. However there is not any json output defined for the eval
command hence the flag is just silently ignored.
From the help: --json Returns output in JSON format if possible, disables verbose and traffic output
We could add the json
flag only for the commands that are applicable, which would render in an error if passed to a command not supporting json output.