mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-23 05:16:55 +00:00
btrfs-progs: image: add option --version, update help text
For completeness and parity with other tools add the option --version and mention --help. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
50f725b707
commit
ff360123c4
11
image/main.c
11
image/main.c
@ -56,6 +56,10 @@ static const char * const image_usage[] = {
|
||||
OPTLINE("-m", "restore for multiple devices"),
|
||||
OPTLINE("-d", "also dump data, conflicts with -w"),
|
||||
"",
|
||||
"General:",
|
||||
OPTLINE("--version", "print the btrfs-image version and exit"),
|
||||
OPTLINE("--help", "print this help and exit"),
|
||||
"",
|
||||
"In the dump mode, source is the btrfs device and target is the output file (use '-' for stdout).",
|
||||
"In the restore mode, source is the dumped image and target is the btrfs device/file.",
|
||||
NULL
|
||||
@ -86,8 +90,10 @@ int BOX_MAIN(image)(int argc, char *argv[])
|
||||
hash_init_accel();
|
||||
|
||||
while (1) {
|
||||
enum { GETOPT_VAL_VERSION = GETOPT_VAL_FIRST };
|
||||
static const struct option long_options[] = {
|
||||
{ "help", no_argument, NULL, GETOPT_VAL_HELP},
|
||||
{ "version", no_argument, NULL, GETOPT_VAL_VERSION },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
int c = getopt_long(argc, argv, "rc:t:oswmd", long_options, NULL);
|
||||
@ -133,6 +139,10 @@ int BOX_MAIN(image)(int argc, char *argv[])
|
||||
btrfs_warn_experimental("Feature: dump image with data");
|
||||
dump_data = true;
|
||||
break;
|
||||
case GETOPT_VAL_VERSION:
|
||||
printf("btrfs-image, part of %s\n", PACKAGE_STRING);
|
||||
ret = 0;
|
||||
goto success;
|
||||
case GETOPT_VAL_HELP:
|
||||
default:
|
||||
usage(&image_cmd, c != GETOPT_VAL_HELP);
|
||||
@ -293,5 +303,6 @@ out:
|
||||
|
||||
btrfs_close_all_devices();
|
||||
|
||||
success:
|
||||
return !!ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user