1
0
mirror of https://github.com/systemd/systemd synced 2025-10-05 16:03:15 +02:00

export: use table to parse --format=

This commit is contained in:
David Tardon
2025-09-26 15:25:02 +02:00
parent 0c3639d0f5
commit 854789543b

View File

@@ -249,17 +249,8 @@ static int parse_argv(int argc, char *argv[]) {
return version();
case ARG_FORMAT:
if (streq(optarg, "uncompressed"))
arg_compress = IMPORT_COMPRESS_UNCOMPRESSED;
else if (streq(optarg, "xz"))
arg_compress = IMPORT_COMPRESS_XZ;
else if (streq(optarg, "gzip"))
arg_compress = IMPORT_COMPRESS_GZIP;
else if (streq(optarg, "bzip2"))
arg_compress = IMPORT_COMPRESS_BZIP2;
else if (streq(optarg, "zstd"))
arg_compress = IMPORT_COMPRESS_ZSTD;
else
arg_compress = import_compress_type_from_string(optarg);
if (arg_compress < 0 || arg_compress == IMPORT_COMPRESS_UNKNOWN)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Unknown format: %s", optarg);
break;