Skip to content

Commit

Permalink
btrfs-progs: subvolume: convert help text to option formatter
Browse files Browse the repository at this point in the history
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
kdave committed Feb 22, 2023
1 parent 28b01ba commit 76b5561
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 36 deletions.
44 changes: 20 additions & 24 deletions cmds/subvolume-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,38 +47,34 @@ static const char * const cmd_subvolume_list_usage[] = {
"List subvolumes and snapshots in the filesystem.",
"",
"Path filtering:",
"-o print only subvolumes below specified path",
"-a print all the subvolumes in the filesystem and",
" distinguish absolute and relative path with respect",
" to the given <path>",
OPTLINE("-o", "print only subvolumes below specified path"),
OPTLINE("-a", "print all the subvolumes in the filesystem and "
"distinguish absolute and relative path with respect to the given <path>"),
"",
"Field selection:",
"-p print parent ID",
"-c print the ogeneration of the subvolume",
"-g print the generation of the subvolume",
"-u print the uuid of subvolumes (and snapshots)",
"-q print the parent uuid of the snapshots",
"-R print the uuid of the received snapshots",
OPTLINE("-p", "print parent ID"),
OPTLINE("-c", "print the ogeneration of the subvolume"),
OPTLINE("-g", "print the generation of the subvolume"),
OPTLINE("-u", "print the uuid of subvolumes (and snapshots)"),
OPTLINE("-q", "print the parent uuid of the snapshots"),
OPTLINE("-R", "print the uuid of the received snapshots"),
"",
"Type filtering:",
"-s list only snapshots",
"-r list readonly subvolumes (including snapshots)",
"-d list deleted subvolumes that are not yet cleaned",
OPTLINE("-s", "list only snapshots"),
OPTLINE("-r", "list readonly subvolumes (including snapshots)"),
OPTLINE("-d", "list deleted subvolumes that are not yet cleaned"),
"",
"Other:",
"-t print the result as a table",
OPTLINE("-t", "print the result as a table"),
"",
"Sorting:",
"-G [+|-]value",
" filter the subvolumes by generation",
" (+value: >= value; -value: <= value; value: = value)",
"-C [+|-]value",
" filter the subvolumes by ogeneration",
" (+value: >= value; -value: <= value; value: = value)",
"--sort=gen,ogen,rootid,path",
" list the subvolume in order of gen, ogen, rootid or path",
" you also can add '+' or '-' in front of each items.",
" (+:ascending, -:descending, ascending default)",
OPTLINE("-G [+|-]value", "filter the subvolumes by generation "
"(+value: >= value; -value: <= value; value: = value)"),
OPTLINE("-C [+|-]value", "filter the subvolumes by ogeneration "
"(+value: >= value; -value: <= value; value: = value)"),
OPTLINE("--sort=gen,ogen,rootid,path", "list the subvolume in order of gen, ogen, rootid or path "
"you also can add '+' or '-' in front of each items. "
"(+:ascending, -:descending, ascending default)"),
NULL,
};

Expand Down
22 changes: 10 additions & 12 deletions cmds/subvolume.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ static const char * const cmd_subvolume_create_usage[] = {
"Create a subvolume <name> in <dest>. If <dest> is not given",
"subvolume <name> will be created in the current directory.",
"",
"-i <qgroupid> add the newly created subvolume to a qgroup. This",
" option can be given multiple times.",
OPTLINE("-i <qgroupid>", "add the newly created subvolume to a qgroup. This option can be given multiple times."),
HELPINFO_INSERT_GLOBALS,
HELPINFO_INSERT_QUIET,
NULL
Expand Down Expand Up @@ -239,10 +238,10 @@ static const char * const cmd_subvolume_delete_usage[] = {
"after a crash). Use one of the --commit options to wait until the",
"operation is safely stored on the media.",
"",
"-c|--commit-after wait for transaction commit at the end of the operation",
"-C|--commit-each wait for transaction commit after deleting each subvolume",
"-i|--subvolid subvolume id of the to be removed subvolume",
"-v|--verbose deprecated, alias for global -v option",
OPTLINE("-c|--commit-after", "wait for transaction commit at the end of the operation"),
OPTLINE("-C|--commit-each", "wait for transaction commit after deleting each subvolume"),
OPTLINE("-i|--subvolid", "subvolume id of the to be removed subvolume"),
OPTLINE("-v|--verbose", "deprecated, alias for global -v option"),
HELPINFO_INSERT_GLOBALS,
HELPINFO_INSERT_VERBOSE,
HELPINFO_INSERT_QUIET,
Expand Down Expand Up @@ -517,9 +516,8 @@ static const char * const cmd_subvolume_snapshot_usage[] = {
"",
"When only <subdir> is given, the subvolume will be named the basename of <subvolume>.",
"",
"-r Make the new snapshot readonly.",
"-i <qgroupid> Add the new snapshot to a qgroup (a quota group). This",
" option can be given multiple times.",
OPTLINE("-r", "make the new snapshot readonly"),
OPTLINE("-i <qgroupid>", "Add the new snapshot to a qgroup (a quota group). This option can be given multiple times."),
HELPINFO_INSERT_GLOBALS,
HELPINFO_INSERT_QUIET,
NULL
Expand Down Expand Up @@ -1239,8 +1237,8 @@ static const char * const cmd_subvolume_show_usage[] = {
"The subvolume can be specified by path, or by root id or UUID that are",
"looked up relative to the given path",
"",
"-r|--rootid ID root id of the subvolume",
"-u|--uuid UUID UUID of the subvolum",
OPTLINE("-r|--rootid ID", "root id of the subvolume"),
OPTLINE("-u|--uuid UUID", "UUID of the subvolum"),
HELPINFO_UNITS_SHORT_LONG,
NULL
};
Expand Down Expand Up @@ -1514,7 +1512,7 @@ static const char * const cmd_subvolume_sync_usage[] = {
"are completed, but do not wait for subvolumes deleted meanwhile.",
"The status of subvolume ids is checked periodically.",
"",
"-s <N> sleep N seconds between checks (default: 1)",
OPTLINE("-s <N>", "sleep N seconds between checks (default: 1)"),
NULL
};

Expand Down

0 comments on commit 76b5561

Please sign in to comment.