Skip to content

Commit f6cd610

Browse files
committed
split main
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
1 parent 3c0839d commit f6cd610

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

cmd/limactl/main.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,8 @@ func newApp() *cobra.Command {
187187
newTemplateCommand(),
188188
newRestartCommand(),
189189
)
190-
switch runtime.GOOS {
191-
case "darwin":
192-
rootCmd.AddCommand(startAtLoginCommand())
193-
rootCmd.AddCommand(newSudoersCommand())
194-
case "linux":
195-
rootCmd.AddCommand(startAtLoginCommand())
190+
for _, cmd := range additionalAdvancedCommands() {
191+
rootCmd.AddCommand(cmd)
196192
}
197193

198194
return rootCmd

cmd/limactl/main_darwin.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package main
2+
3+
import "github.com/spf13/cobra"
4+
5+
func additionalAdvancedCommands() []*cobra.Command {
6+
return []*cobra.Command{
7+
newSudoersCommand(),
8+
startAtLoginCommand(),
9+
}
10+
}

cmd/limactl/main_linux.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import "github.com/spf13/cobra"
4+
5+
func additionalAdvancedCommands() []*cobra.Command {
6+
return []*cobra.Command{
7+
startAtLoginCommand(),
8+
}
9+
}

cmd/limactl/main_windows.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/spf13/cobra"
4+
5+
func additionalAdvancedCommands() []*cobra.Command {
6+
return nil
7+
}

cmd/limactl/start-at-login.go renamed to cmd/limactl/start-at-login_unix.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build !windows
2+
13
// SPDX-FileCopyrightText: Copyright The Lima Authors
24
// SPDX-License-Identifier: Apache-2.0
35

cmd/limactl/sudoers.go renamed to cmd/limactl/sudoers_darwin.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"errors"
88
"fmt"
99
"io"
10-
"runtime"
1110

1211
"github.com/lima-vm/lima/pkg/networks"
1312
"github.com/sirupsen/logrus"

0 commit comments

Comments
 (0)