btrfs-progs: reformat global options and update docs

With the growing list of global option we need to print them somewhere
in the help text and document them.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-02-22 01:21:07 +01:00
parent 67964cbcda
commit 5edf4950b4
2 changed files with 40 additions and 2 deletions

View File

@ -4,7 +4,7 @@ btrfs(8)
SYNOPSIS
--------
**btrfs** <command> [<args>]
**btrfs** [global] <group> [<group>...] <command> [<args>]
DESCRIPTION
-----------
@ -44,6 +44,30 @@ All numbers will be formatted according to the rules of the `C` locale
For an overview of a given command use **btrfs command --help**
or **btrfs [command...] --help --full** to print all available options.
There are global options that are passed between *btrfs* and the *group* name
and affect behaviour not specific to the command, e.g. verbosity or the type
of the output.
--format <format>
if supported by the command, print subcommand output in that format (text, json)
-v|--verbose
increase verbosity of the subcommand\n"
-q|--quiet
print only errors\n"
--log <level>
set log level (default, info, verbose, debug, quiet)\n"
The remaining options are relevant only for the main tool:
--help
print condensed help for all subcommands
--version
print version string
COMMANDS
--------

16
btrfs.c
View File

@ -32,7 +32,21 @@
#include "cmds/commands.h"
static const char * const btrfs_cmd_group_usage[] = {
"btrfs [--help] [--version] [--format <format>] [-v|--verbose] [-q|--quiet] [--log=level] <group> [<group>...] <command> [<args>]",
/*
* The main command group is the only one that takes options so this
* needs the newlines and manual formatting.
*/
"btrfs [global] <group> [<group>...] <command> [<args>]\n"
"\n"
"Global options:\n"
" --format <format> if supported, print subcommand output in that format (text, json)\n"
" -v|--verbose increase verbosity of the subcommand\n"
" -q|--quiet print only errors\n"
" --log <level> set log level (default, info, verbose, debug, quiet)\n"
"\n"
"Options for the main command only:\n"
" --help print condensed help for all subcommands\n"
" --version print version string",
NULL
};