()
| 133 | } |
| 134 | |
| 135 | func direnvCmd() *cobra.Command { |
| 136 | flags := &generateCmdFlags{} |
| 137 | command := &cobra.Command{ |
| 138 | Use: "direnv", |
| 139 | Short: "Generate a .envrc file that integrates direnv with this devbox project", |
| 140 | Long: "Generate a .envrc file that integrates direnv with this devbox project. " + |
| 141 | "Requires direnv to be installed.", |
| 142 | Args: cobra.MaximumNArgs(0), |
| 143 | RunE: func(cmd *cobra.Command, args []string) error { |
| 144 | return runGenerateDirenvCmd(cmd, flags) |
| 145 | }, |
| 146 | } |
| 147 | flags.envFlag.register(command) |
| 148 | command.Flags().BoolVarP( |
| 149 | &flags.force, "force", "f", false, "force overwrite existing files") |
| 150 | command.Flags().BoolVarP( |
| 151 | &flags.printEnvrcContent, "print-envrc", "p", false, |
| 152 | "output contents of devbox configuration to use in .envrc") |
| 153 | // this command marks a flag as hidden. Error handling for it is not necessary. |
| 154 | _ = command.Flags().MarkHidden("print-envrc") |
| 155 | |
| 156 | // --envrc-dir allows users to specify a directory where the .envrc file should be generated |
| 157 | // separately from the devbox config directory. Without this flag, the .envrc file |
| 158 | // will be generated in the same directory as the devbox config file (i.e., either the current |
| 159 | // directory or the directory specified by --config). This flag is useful for users who want to |
| 160 | // keep their .envrc and devbox config files in different locations. |
| 161 | command.Flags().StringVar( |
| 162 | &flags.envrcDir, "envrc-dir", "", |
| 163 | "path to directory where the .envrc file should be generated.\n"+ |
| 164 | "If not specified, the .envrc file will be generated in the same directory as\n"+ |
| 165 | "the devbox.json.") |
| 166 | |
| 167 | flags.config.register(command) |
| 168 | return command |
| 169 | } |
| 170 | |
| 171 | func genReadmeCmd() *cobra.Command { |
| 172 | flags := &GenerateReadmeCmdFlags{} |
no test coverage detected