Documentation ¶
Index ¶
Constants ¶
View Source
const RecordFileName = ".gocmd"
Variables ¶
View Source
var ( RootCmd = &cobra.Command{ Use: "gocmd", } InitCmd = &cobra.Command{ Use: "init", Short: "Save all golang cli", PreRun: func(cmd *cobra.Command, args []string) { if srcPath == "" { srcPath = getSrcPathFromEnv() } if binPath == "" { binPath = getBinPathFromEnv() } if dotGoCmdDir == "" { var err error dotGoCmdDir, err = homedir.Dir() if err != nil { panic(err) } } if errors := existsDir(srcPath, binPath, dotGoCmdDir); len(errors) > 0 { for _, err := range errors { color.Red(err.Error()) } os.Exit(1) } }, Run: func(cmd *cobra.Command, args []string) { gitDirs := goCommands(srcPath, binPath) recordFile(gitDirs, dotGoCmdDir) color.Green("created \"%v\" successfully!", path.Join(dotGoCmdDir, RecordFileName)) }, } InstallCmd = &cobra.Command{ Use: "install", Short: "Install golang cli from .gocmd", PreRun: func(cmd *cobra.Command, args []string) { if dotGoCmdDir == "" { var err error dotGoCmdDir, err = homedir.Dir() if err != nil { panic(err) } } if errors := existsDir(dotGoCmdDir); len(errors) > 0 { for _, err := range errors { color.Red(err.Error()) } os.Exit(1) } }, Run: func(cmd *cobra.Command, args []string) { install(dotGoCmdDir) }, } )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.