Skip to content

Commit 25c1581

Browse files
committed
sudoers: improve --help
Signed-off-by: Akihiro Suda <[email protected]>
1 parent 6210fd4 commit 25c1581

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cmd/limactl/sudoers.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@ package main
33
import (
44
"errors"
55
"fmt"
6+
"os"
7+
"path/filepath"
68
"runtime"
79

810
"github.com/lima-vm/lima/pkg/networks"
911
"github.com/spf13/cobra"
1012
)
1113

1214
func newSudoersCommand() *cobra.Command {
15+
networksMD := "$PREFIX/share/doc/lima/docs/network.md"
16+
if exe, err := os.Executable(); err == nil {
17+
binDir := filepath.Dir(exe)
18+
prefixDir := filepath.Dir(binDir)
19+
networksMD = filepath.Join(prefixDir, "share/doc/lima/docs/network.md")
20+
}
1321
sudoersCommand := &cobra.Command{
1422
Use: "sudoers [SUDOERSFILE]",
15-
Short: "Generate /etc/sudoers.d/lima file.",
23+
Short: "Generate /etc/sudoers.d/lima file for enabling vmnet.framework support",
24+
Long: fmt.Sprintf("Generate /etc/sudoers.d/lima file for enabling vmnet.framework support.\nSee %s for the usage.", networksMD),
1625
Args: cobra.MaximumNArgs(1),
1726
RunE: sudoersAction,
1827
}
@@ -67,4 +76,4 @@ func verifySudoAccess(args []string) error {
6776
}
6877
fmt.Printf("%q is up-to-date (or sudo doesn't require a password)\n", file)
6978
return nil
70-
}
79+
}

0 commit comments

Comments
 (0)