Add --verbose and --quiet command options to show verbose or no output
from the subcommands. By introducing global a bconf::verbose memeber to
propagate the same down to the subcommand.
Further the added helper function pr_verbose() helps to logs the verbose
messages, based on the state of the %bconf::verbose. And further HELPINFO_
defines are provided for the usage.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
As of now the define HELPINFO_INSERT_GLOBALS if used as in the example
as below (as of now its not been used anywhere) will print the help
texts as shown below
$ ./btrfs fi show --help
<snip>
Global options:
--format TYPE where TYPE is: text
So in preparation to add --verbose and --quiet global options, and
apparently --format is not being used yet, this patch splits the global
options into two defines.
"Global options:"
So that the currently added global options --verbose and --quiet can use
the define HELPINFO_INSERT_GLOBALS header as shown below.
$ ./btrfs fi show --help
<snip>
Global options:
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Global options should be printed right after the command options, but
there could be text following the options. Add a marker that will allow
to order the options before that text.
Signed-off-by: David Sterba <dsterba@suse.com>
This adds a global --format option to request extended output formats
from each command.
We currently only support text mode. Command help reports what
output formats are available for each command. Global help reports
what valid formats are.
If an invalid format is requested, an error is reported and lists the
valid formats.
Each command sets a bitmask that describes which formats it is capable
of outputting. If a globally valid format is requested of a command
that doesn't support it, an error is reported and command usage dumped.
Commands don't need to specify that they support text output. All
commands are required to output text.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
[ use global config instead of passing cmd_context ]
Signed-off-by: David Sterba <dsterba@suse.com>