MCPcopy Index your code
hub / github.com/jetify-com/devbox / shellCmd

Function shellCmd

internal/boxcli/shell.go:34–63  ·  view source on GitHub ↗
(defaults shellFlagDefaults)

Source from the content-addressed store, hash-verified

32}
33
34func shellCmd(defaults shellFlagDefaults) *cobra.Command {
35 flags := shellCmdFlags{}
36 command := &cobra.Command{
37 Use: "shell",
38 Short: "Start a new shell with access to your packages",
39 Long: "Start a new shell with access to your packages.\n\n" +
40 "If the --config flag is set, the shell will be started using the devbox.json found in the --config flag directory. " +
41 "If --config isn't set, then devbox recursively searches the current directory and its parents.",
42 Args: cobra.NoArgs,
43 PreRunE: ensureNixInstalled,
44 RunE: func(cmd *cobra.Command, args []string) error {
45 return runShellCmd(cmd, flags)
46 },
47 }
48
49 command.Flags().BoolVar(
50 &flags.printEnv, "print-env", false, "print script to setup shell environment")
51 command.Flags().BoolVar(
52 &flags.pure, "pure", false, "if this flag is specified, devbox creates an isolated shell inheriting almost no variables from the current environment. A few variables, in particular HOME, USER and DISPLAY, are retained.")
53 command.Flags().BoolVar(
54 &flags.omitNixEnv, "omit-nix-env", defaults.omitNixEnv,
55 "shell environment will omit the env-vars from print-dev-env",
56 )
57 _ = command.Flags().MarkHidden("omit-nix-env")
58 command.Flags().BoolVar(&flags.recomputeEnv, "recompute", true, "recompute environment if needed")
59
60 flags.config.register(command)
61 flags.envFlag.register(command)
62 return command
63}
64
65func runShellCmd(cmd *cobra.Command, flags shellCmdFlags) error {
66 ctx := cmd.Context()

Callers 1

RootCmdFunction · 0.85

Calls 2

runShellCmdFunction · 0.85
registerMethod · 0.45

Tested by

no test coverage detected