(cmd *cobra.Command, args []string)
| 91 | } |
| 92 | |
| 93 | func ensureGlobalEnvEnabled(cmd *cobra.Command, args []string) error { |
| 94 | if cmd.Name() == "shellenv" { |
| 95 | return nil |
| 96 | } |
| 97 | path, err := ensureGlobalConfig() |
| 98 | if err != nil { |
| 99 | return errors.WithStack(err) |
| 100 | } |
| 101 | |
| 102 | box, err := devbox.Open(&devopt.Opts{ |
| 103 | Dir: path, |
| 104 | Stderr: cmd.ErrOrStderr(), |
| 105 | }) |
| 106 | if err != nil { |
| 107 | return err |
| 108 | } |
| 109 | if !box.IsEnvEnabled() { |
| 110 | fmt.Fprintln(cmd.ErrOrStderr()) |
| 111 | ux.Fwarningf( |
| 112 | cmd.ErrOrStderr(), |
| 113 | `devbox global is not activated. |
| 114 | |
| 115 | Add the following line to your shell's rcfile and restart your shell: |
| 116 | |
| 117 | For bash/zsh (~/.bashrc or ~/.zshrc): |
| 118 | eval "$(devbox global shellenv)" |
| 119 | |
| 120 | For nushell: See NUSHELL.md for setup instructions |
| 121 | `, |
| 122 | ) |
| 123 | } |
| 124 | return nil |
| 125 | } |
nothing calls this directly
no test coverage detected