mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-25 04:27:54 +00:00
btrfs-progs: convert: 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
5e5764a64d
commit
6db97057a8
@ -1868,6 +1868,10 @@ static const char * const convert_usage[] = {
|
|||||||
OPTLINE("-O|--features LIST", "comma separated list of filesystem features"),
|
OPTLINE("-O|--features LIST", "comma separated list of filesystem features"),
|
||||||
OPTLINE("--no-progress", "show only overview, not the detailed progress"),
|
OPTLINE("--no-progress", "show only overview, not the detailed progress"),
|
||||||
"",
|
"",
|
||||||
|
"General:",
|
||||||
|
OPTLINE("--version", "print the btrfs-convert version and exit"),
|
||||||
|
OPTLINE("--help", "print this help and exit"),
|
||||||
|
"",
|
||||||
"Supported filesystems:",
|
"Supported filesystems:",
|
||||||
"\text2/3/4: "
|
"\text2/3/4: "
|
||||||
#if BTRFSCONVERT_EXT2
|
#if BTRFSCONVERT_EXT2
|
||||||
@ -1910,11 +1914,10 @@ int BOX_MAIN(convert)(int argc, char *argv[])
|
|||||||
cpu_detect_flags();
|
cpu_detect_flags();
|
||||||
hash_init_accel();
|
hash_init_accel();
|
||||||
btrfs_assert_feature_buf_size();
|
btrfs_assert_feature_buf_size();
|
||||||
printf("btrfs-convert from %s\n\n", PACKAGE_STRING);
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
enum { GETOPT_VAL_NO_PROGRESS = GETOPT_VAL_FIRST, GETOPT_VAL_CHECKSUM,
|
enum { GETOPT_VAL_NO_PROGRESS = GETOPT_VAL_FIRST, GETOPT_VAL_CHECKSUM,
|
||||||
GETOPT_VAL_UUID };
|
GETOPT_VAL_UUID, GETOPT_VAL_VERSION };
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{ "no-progress", no_argument, NULL,
|
{ "no-progress", no_argument, NULL,
|
||||||
GETOPT_VAL_NO_PROGRESS },
|
GETOPT_VAL_NO_PROGRESS },
|
||||||
@ -1932,7 +1935,8 @@ int BOX_MAIN(convert)(int argc, char *argv[])
|
|||||||
{ "copy-label", no_argument, NULL, 'L' },
|
{ "copy-label", no_argument, NULL, 'L' },
|
||||||
{ "uuid", required_argument, NULL, GETOPT_VAL_UUID },
|
{ "uuid", required_argument, NULL, GETOPT_VAL_UUID },
|
||||||
{ "nodesize", required_argument, NULL, 'N' },
|
{ "nodesize", required_argument, NULL, 'N' },
|
||||||
{ "help", no_argument, NULL, GETOPT_VAL_HELP},
|
{ "help", no_argument, NULL, GETOPT_VAL_HELP },
|
||||||
|
{ "version", no_argument, NULL, GETOPT_VAL_VERSION },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
int c = getopt_long(argc, argv, "dinN:rl:LpO:", long_options, NULL);
|
int c = getopt_long(argc, argv, "dinN:rl:LpO:", long_options, NULL);
|
||||||
@ -2024,11 +2028,18 @@ int BOX_MAIN(convert)(int argc, char *argv[])
|
|||||||
strncpy_null(fsid, optarg, sizeof(fsid));
|
strncpy_null(fsid, optarg, sizeof(fsid));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GETOPT_VAL_VERSION:
|
||||||
|
printf("btrfs-convert, part of %s\n", PACKAGE_STRING);
|
||||||
|
ret = 0;
|
||||||
|
goto success;
|
||||||
case GETOPT_VAL_HELP:
|
case GETOPT_VAL_HELP:
|
||||||
default:
|
default:
|
||||||
usage(&convert_cmd, c != GETOPT_VAL_HELP);
|
usage(&convert_cmd, c != GETOPT_VAL_HELP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("btrfs-convert from %s\n\n", PACKAGE_STRING);
|
||||||
|
|
||||||
set_argv0(argv);
|
set_argv0(argv);
|
||||||
if (check_argc_exact(argc - optind, 1)) {
|
if (check_argc_exact(argc - optind, 1)) {
|
||||||
usage(&convert_cmd, 1);
|
usage(&convert_cmd, 1);
|
||||||
@ -2072,5 +2083,6 @@ int BOX_MAIN(convert)(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
return 1;
|
return 1;
|
||||||
|
success:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user