main: tweak handling of --output-name to avoid adding double extensions

This commit tweaks the handling of the `--output-name` option so
that is a name with the same extension as the image is passed that
is just silently ignored. Its a common issue that first time
users run:
```console
$ image-builder build --output-name foo.qcow2 qcow2
```
which currently leads to a foo.qcow2.qcow2. With this commit
the expected "foo.qcow2" will appear.
This commit is contained in:
Michael Vogt 2025-03-20 11:12:33 +01:00
parent d4c31389a9
commit d00e76ced1
4 changed files with 46 additions and 4 deletions

View file

@ -16,6 +16,7 @@ var (
FindDistro = findDistro
DescribeImage = describeImage
ProgressFromCmd = progressFromCmd
BasenameFor = basenameFor
)
func MockOsArgs(new []string) (restore func()) {