diff options
author | Michael Tokarev <mjt@tls.msk.ru> | 2025-05-31 20:16:01 +0300 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2025-07-15 20:49:01 +0200 |
commit | 8737b342e236c8cf5e4ae1f5cc0f519a23a6dd2b (patch) | |
tree | 2038a5b3c001934290c90c02f080325d51b78da4 /scripts/qapi/expr.py | |
parent | c1563952521d4d5947b4279efe8dcc432791287e (diff) | |
download | qemu-8737b342e236c8cf5e4ae1f5cc0f519a23a6dd2b.zip qemu-8737b342e236c8cf5e4ae1f5cc0f519a23a6dd2b.tar.gz qemu-8737b342e236c8cf5e4ae1f5cc0f519a23a6dd2b.tar.bz2 |
qemu-img: resize: do not always eat last argument
'qemu-img resize --help' does not work, since it wants more
arguments. Also -size is only recognized as a very last
argument, but it is common for tools to handle other options
after positional arguments too.
Tell getopt_long() to return non-options together with options,
and process filename and size in the loop, and check if there's
an argument right after filename which looks like -N (number),
and treat it as size (decrement). This way we can handle --help,
and we can also have options after filename and size, and `--'
will be handled fine too.
The only case which is not handled right is when there's an option
between filename and size, and size is given as decrement, - in
this case -size will be treated as option, not as size.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Message-ID: <20250531171609.197078-20-mjt@tls.msk.ru>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'scripts/qapi/expr.py')
0 files changed, 0 insertions, 0 deletions