Skip to content

Commit

Permalink
Move template locator and reader code into new limatmpl package
Browse files Browse the repository at this point in the history
It was part of cmd/limactl/start.go but should be generally reusable code.
Moved related cmd/limactl/guessarg into limatmpl as well.

Also created a new `limactl template` command.

It takes a single template locator argument, loads the template,
and writes it to STDOUT.

This is currently not very interesting; it is in preparation of
implementing composable (multi-file) templates.

Signed-off-by: Jan Dubois <[email protected]>
  • Loading branch information
jandubois committed Dec 22, 2024
1 parent 4a40ad0 commit 3e18003
Show file tree
Hide file tree
Showing 7 changed files with 350 additions and 250 deletions.
4 changes: 2 additions & 2 deletions cmd/limactl/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"path/filepath"

"github.com/lima-vm/lima/cmd/limactl/editflags"
"github.com/lima-vm/lima/cmd/limactl/guessarg"
"github.com/lima-vm/lima/pkg/editutil"
"github.com/lima-vm/lima/pkg/instance"
"github.com/lima-vm/lima/pkg/limatmpl"
"github.com/lima-vm/lima/pkg/limayaml"
networks "github.com/lima-vm/lima/pkg/networks/reconcile"
"github.com/lima-vm/lima/pkg/store"
Expand Down Expand Up @@ -44,7 +44,7 @@ func editAction(cmd *cobra.Command, args []string) error {
var err error
var inst *store.Instance
switch {
case guessarg.SeemsYAMLPath(arg):
case limatmpl.SeemsYAMLPath(arg):
// absolute path is required for `limayaml.Validate`
filePath, err = filepath.Abs(arg)
if err != nil {
Expand Down
65 changes: 0 additions & 65 deletions cmd/limactl/guessarg/guessarg.go

This file was deleted.

1 change: 1 addition & 0 deletions cmd/limactl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func newApp() *cobra.Command {
newProtectCommand(),
newUnprotectCommand(),
newTunnelCommand(),
newTemplateCommand(),
)
if runtime.GOOS == "darwin" || runtime.GOOS == "linux" {
rootCmd.AddCommand(startAtLoginCommand())
Expand Down
Loading

0 comments on commit 3e18003

Please sign in to comment.