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

Function genReadmeCmd

internal/boxcli/generate.go:171–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169}
170
171func genReadmeCmd() *cobra.Command {
172 flags := &GenerateReadmeCmdFlags{}
173
174 command := &cobra.Command{
175 Use: "readme [filename]",
176 Short: "Generate markdown readme file for this project",
177 Args: cobra.MaximumNArgs(1),
178 RunE: func(cmd *cobra.Command, args []string) error {
179 box, err := devbox.Open(&devopt.Opts{
180 Dir: flags.config.path,
181 Environment: flags.config.environment,
182 Stderr: cmd.ErrOrStderr(),
183 })
184 if err != nil {
185 return errors.WithStack(err)
186 }
187 outPath := ""
188 if len(args) > 0 {
189 outPath = args[0]
190 }
191 if flags.saveTemplate {
192 return docgen.SaveDefaultReadmeTemplate(outPath)
193 }
194 return docgen.GenerateReadme(box, outPath, flags.template)
195 },
196 }
197 flags.config.register(command)
198 command.Flags().BoolVar(
199 &flags.saveTemplate, "save-template", false, "Save default template for the README file")
200 command.Flags().StringVarP(
201 &flags.template, "template", "t", "", "Path to a custom template for the README file")
202
203 return command
204}
205
206func genAliasCmd() *cobra.Command {
207 flags := &GenerateAliasCmdFlags{}

Callers 1

generateCmdFunction · 0.85

Calls 4

OpenFunction · 0.92
GenerateReadmeFunction · 0.92
registerMethod · 0.45

Tested by

no test coverage detected