cmd-compress: move default compressor logic out of argparse
Reframe the `--compressor` option as an override of the default, which
is currently `gzip`.
@@ -30,10 +30,8 @@ parser = argparse.ArgumentParser()
parser.add_argument("--build", help="Build ID")
parser.add_argument("--artifact", default=[], action='append',
help="Only compress given image ARTIFACT", metavar="ARTIFACT")
-parser.add_argument("--compressor",
- choices=['xz', 'gzip'],
- default=DEFAULT_COMPRESSOR,
- help=f"Compressor to use, default is {DEFAULT_COMPRESSOR}")
+parser.add_argument("--compressor", choices=['xz', 'gzip'],
+ help="Override compressor to use")
parser.add_argument("--mode",
choices=['compress', 'uncompress'],
default=DEFAULT_MODE,
@@ -57,6 +55,8 @@ gzip_level = 6
if args.fast:
args.compressor = 'gzip'
gzip_level = 1
+elif not args.compressor:
+ args.compressor = DEFAULT_COMPRESSOR
# find extension for compressor
ext_dict = {'xz': '.xz', 'gzip': '.gz'}
