fix(create): honor positional container_name argument

`distrobox create --image alpine my-box` silently ignored the
positional; only --name was read. Override ContainerName from
cmd.Args().First() to match the shell (distrobox-create:453-461).

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
This commit is contained in:
Luca Di Maio committed 2026-06-25 09:07:23 +02:00
1 parent 07df5ad96b
commit 556c8bb2ec
1 file changed
+7
+7
View File
@@ -223,6 +223,13 @@ func createAction(ctx context.Context, cmd *cli.Command, cfg *config.Values) err
NonInteractive: cmd.Bool("yes"),
}
// Positional container_name overrides --name, matching the shell
// (distrobox-create:453-461) so `distrobox create --image alpine my-box`
// names the box `my-box`.
if positional := cmd.Args().First(); positional != "" {
opts.ContainerName = positional
}
progress := ui.NewProgress(os.Stderr)
prompter := ui.NewPrompter(*bufio.NewReader(os.Stdin), os.Stdout)