Verbose mode does not work and is inconsistent
|Status:||Ready For Testing|
|Assigned To:||Oleh Fedorenko|
|Target version:||Foreman - Team Marek backlog|
|Found in release:||Pull request:||https://github.com/theforeman/hammer-cli-foreman/pull/344, https://github.com/theforeman/hammer-cli/pull/263|
|Velocity based estimate||-|
Global flag -v does not seem to work at all.
Do not remove it, it makes sense to have it. In UNIX, commands usually do not print info messages (like "Host created"). Create a method like print_verbose and use it for all info messages (crate, update, delete). These messages should appear on stdout only when -v flag was provided.
#4 Updated by Tomáš Strachota 5 months ago
I'm adding some implementation notes.
At the moment -v has the same effect as -d - it prints logs to stdout. I don't think it was a good choice and in my opinion we should keep only -d for that purpose. At the same time I think it would be confusing for users if we suddenly started using that flag for something else. We should deprecate it first. --verbosity or something similar could be used from the start (it's longer I know).Verbosity should be added to following places in hammer output:
- add verbosity attribute to #print_message, default is 1
- add verbosity attribute to #print_error, not sure what the default value should be here
- add verbosity to fields in output definition
All those messages/fields would be printed only when their verbosity is <= than what a user asked for.
Verbosity should also be configurable in settings.
In order to keep the current behavior unless user explicitly changes the settings, I think that what Lukas describes should be verbosity 0 and default should be 1 (or some other value, but one step higher).
PS: Pagination details in #print_record methods should probably be printed only with higher verbosities.