Skip to content

Commit 0715393

Browse files
committed
Move template locator and reader code into new limatmpl package
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]>
1 parent 4a40ad0 commit 0715393

File tree

8 files changed

+359
-251
lines changed

8 files changed

+359
-251
lines changed

cmd/limactl/edit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"path/filepath"
99

1010
"github.com/lima-vm/lima/cmd/limactl/editflags"
11-
"github.com/lima-vm/lima/cmd/limactl/guessarg"
1211
"github.com/lima-vm/lima/pkg/editutil"
1312
"github.com/lima-vm/lima/pkg/instance"
13+
"github.com/lima-vm/lima/pkg/limatmpl"
1414
"github.com/lima-vm/lima/pkg/limayaml"
1515
networks "github.com/lima-vm/lima/pkg/networks/reconcile"
1616
"github.com/lima-vm/lima/pkg/store"
@@ -44,7 +44,7 @@ func editAction(cmd *cobra.Command, args []string) error {
4444
var err error
4545
var inst *store.Instance
4646
switch {
47-
case guessarg.SeemsYAMLPath(arg):
47+
case limatmpl.SeemsYAMLPath(arg):
4848
// absolute path is required for `limayaml.Validate`
4949
filePath, err = filepath.Abs(arg)
5050
if err != nil {

cmd/limactl/guessarg/guessarg.go

Lines changed: 0 additions & 65 deletions
This file was deleted.

cmd/limactl/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ func newApp() *cobra.Command {
155155
newProtectCommand(),
156156
newUnprotectCommand(),
157157
newTunnelCommand(),
158+
newTemplateCommand(),
158159
)
159160
if runtime.GOOS == "darwin" || runtime.GOOS == "linux" {
160161
rootCmd.AddCommand(startAtLoginCommand())

0 commit comments

Comments
 (0)