github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/cmd/ddev_gen_autocomplete/fig_spec_gen.go (about) 1 package main 2 3 import ( 4 "github.com/ddev/ddev/cmd/ddev/cmd" 5 "github.com/withfig/autocomplete-tools/integrations/cobra" 6 "os" 7 ) 8 9 // Generate a Fig spec 10 func genFigSpecCompletionFile(filename string) error { 11 var spec = cobracompletefig.GenerateCompletionSpec(cmd.RootCmd) 12 f, err := os.Create(filename) 13 if err != nil { 14 return err 15 } 16 _, err = f.WriteString(spec.ToTypescript()) 17 if err != nil { 18 return err 19 } 20 err = f.Close() 21 22 return err 23 }