()
| 51 | ` |
| 52 | |
| 53 | func 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 | |
| 80 | const ( |
| 81 | rsyncMinimumSrcDirDepth = 4 // Depth of "/Users/USER" is 3. |
no test coverage detected