Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CmdWire = &cobra.Command{ Use: "wire", Short: "nunu wire [wire.go path]", Long: "nunu wire [wire.go path]", Example: "nunu wire cmd/server", Run: func(cmd *cobra.Command, args []string) { cmdArgs, _ := helper.SplitArgs(cmd, args) var dir string if len(cmdArgs) > 0 { dir = cmdArgs[0] } base, err := os.Getwd() if err != nil { fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", err) return } if dir == "" { wirePath, err := findWire(base) if err != nil { fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", err) return } switch len(wirePath) { case 0: fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", "The wire.go cannot be found in the current directory") return case 1: for _, v := range wirePath { dir = v } default: var wirePaths []string for k := range wirePath { wirePaths = append(wirePaths, k) } prompt := &survey.Select{ Message: "Which directory do you want to run?", Options: wirePaths, PageSize: 10, } e := survey.AskOne(prompt, &dir) if e != nil || dir == "" { return } dir = wirePath[dir] } } wire(dir) }, }
View Source
var CmdWireAll = &cobra.Command{ Use: "all", Short: "nunu wire all", Long: "nunu wire all", Example: "nunu wire all", Run: func(cmd *cobra.Command, args []string) { cmdArgs, _ := helper.SplitArgs(cmd, args) var dir string if len(cmdArgs) > 0 { dir = cmdArgs[0] } base, err := os.Getwd() if err != nil { fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", err) return } if dir == "" { wirePath, err := findWire(base) if err != nil { fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", err) return } switch len(wirePath) { case 0: fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", "The wire.go cannot be found in the current directory") return default: for _, v := range wirePath { wire(v) } } } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.