gen_bash_completion.go

 1// +build ignore
 2
 3package main
 4
 5import (
 6	"fmt"
 7	"github.com/MichaelMure/git-bug/commands"
 8	"log"
 9	"os"
10	"path"
11)
12
13func main() {
14	cwd, _ := os.Getwd()
15	filepath := path.Join(cwd, "misc", "bash_completion", "git-bug")
16
17	fmt.Println("Generating bash completion file ...")
18
19	//git := &cobra.Command{
20	//	Use: "git",
21	//	BashCompletionFunction: "qsdhjlkqsdhlsd",
22	//}
23	//
24	//bug := &cobra.Command{
25	//	Use: "bug",
26	//	BashCompletionFunction: "ZHZLDHKLZDHJKL",
27	//}
28	//git.AddCommand(bug)
29
30	//for _, sub := range commands.RootCmd.Commands() {
31	//	bug.AddCommand(sub)
32	//}
33
34	//err := git.GenBashCompletionFile(filepath)
35	err := commands.RootCmd.GenBashCompletionFile(filepath)
36	if err != nil {
37		log.Fatal(err)
38	}
39}