MCPcopy Index your code
hub / github.com/lima-vm/lima / newShellCommand

Function newShellCommand

cmd/limactl/shell.go:53–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51`
52
53func newShellCommand() *cobra.Command {
54 shellCmd := &cobra.Command{
55 Use: "shell [flags] INSTANCE [COMMAND...]",
56 SuggestFor: []string{"ssh"},
57 Short: "Execute shell in Lima",
58 Long: shellHelp,
59 Args: WrapArgsError(cobra.ArbitraryArgs),
60 RunE: shellAction,
61 ValidArgsFunction: shellBashComplete,
62 SilenceErrors: true,
63 GroupID: basicCommand,
64 }
65
66 shellCmd.Flags().SetInterspersed(false)
67
68 shellCmd.Flags().String("instance", "", "Instance name (used by the lima wrapper script)")
69 _ = shellCmd.Flags().MarkHidden("instance")
70 shellCmd.Flags().String("shell", "", "Shell interpreter, e.g. /bin/bash")
71 shellCmd.Flags().String("workdir", "", "Working directory")
72 shellCmd.Flags().Bool("reconnect", false, "Reconnect to the SSH session")
73 shellCmd.Flags().Bool("preserve-env", false, "Propagate environment variables to the shell")
74 shellCmd.Flags().Bool("start", false, "Start the instance if it is not already running")
75 shellCmd.Flags().String("sync", "", "Copy a host directory to the guest and vice-versa upon exit")
76
77 return shellCmd
78}
79
80const (
81 rsyncMinimumSrcDirDepth = 4 // Depth of "/Users/USER" is 3.

Callers 1

newAppFunction · 0.85

Calls 2

WrapArgsErrorFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected