Skip to content

feature(cli): allow multiple template sources on command line#4557

Open
jkylling wants to merge 1 commit intolima-vm:masterfrom
jkylling:feat/multi-template-cli-args
Open

feature(cli): allow multiple template sources on command line#4557
jkylling wants to merge 1 commit intolima-vm:masterfrom
jkylling:feat/multi-template-cli-args

Conversation

@jkylling
Copy link
Copy Markdown

@jkylling jkylling commented Feb 2, 2026

Enable passing multiple template files/URLs to limactl create and limactl start.

Example usage:
limactl create template:docker my-overrides.yaml
limactl create https://example.com/base.yaml secrets.yaml

This is equivalent to using the base: property in YAML:
base: [https://example.com/template.yaml, $PWD/secrets.yaml]

Fixes #3404

@jkylling jkylling force-pushed the feat/multi-template-cli-args branch from ac6523c to 2583061 Compare February 2, 2026 14:04
Enable passing multiple template files/URLs to `limactl create` and
`limactl start`.

Example usage:
  limactl create template:docker my-overrides.yaml
  limactl create https://example.com/base.yaml secrets.yaml

This is equivalent to using the `base:` property in YAML:
  base: [https://example.com/template.yaml, $PWD/secrets.yaml]

Fixes lima-vm#3404

Signed-off-by: Jonas Irgens Kylling <jkylling@gmail.com>
@jkylling jkylling force-pushed the feat/multi-template-cli-args branch from 2583061 to e9b3042 Compare February 2, 2026 14:15
@jandubois jandubois self-requested a review February 2, 2026 20:06
Copy link
Copy Markdown
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR drops most of the special cases for specifying templates on the command line. Even the simple single-arg case no longer works:

limactl start template:alpine
FATA[0000] cannot derive instance name from "template:alpine": filename "template:alpine" is invalid: identifier "template:alpine" must match ^[A-Za-z0-9]+(?:[._-](?:[A-Za-z0-9]+))*$

Using an image URL no longer creates a short instance name:

limactl start https://dl-cdn.alpinelinux.org/alpine/v3.23/releases/cloud/nocloud_alpine-3.23.2-aarch64-uefi-cloudinit-r0.qcow2
? Creating an instance "nocloud_alpine-3.23.2-aarch64-uefi-cloudinit-r0.qcow2" Proceed with the current configuration
...

It looks like the special handling for - (stdin) only works for the first argument.

I haven't reviewed the code yet, but we should probably start by creating a bunch of BATS tests for the current behaviour, so we can be sure refactoring to implement multiple input templates is not breaking any of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow additional base templates to be specified during limactl create

2 participants