Skip to content

Commit

Permalink
Merge pull request #13 from lpxxn/custom_command
Browse files Browse the repository at this point in the history
feat: custom command
  • Loading branch information
lpxxn authored Jun 1, 2021
2 parents 5b165c8 + 99a07c6 commit 53834c9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmd/doraemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ func RootCMD(lc fx.Lifecycle, param cmdParam) *cobra.Command {
if strings.Trim(cmdName, " ") == "" {
continue
}
runed, needExist := runGlobalCmd(cmdName)
if runed && needExist {
ran, needExist := runGlobalCmd(cmdName)
if ran && needExist {
break exitCmd
}
if runed {
if ran {
continue
}
if err := startSSHShell(cmdName); err != nil {
Expand Down Expand Up @@ -121,7 +121,7 @@ func RootCMD(lc fx.Lifecycle, param cmdParam) *cobra.Command {
return rootCmd
}

func runGlobalCmd(cmdName string) (runed bool, needExist bool) {
func runGlobalCmd(cmdName string) (ran bool, needExist bool) {
if _, ok := existCommand[cmdName]; ok {
fmt.Println("👋👋👋 bye ~")
return true, true
Expand Down Expand Up @@ -155,11 +155,11 @@ func customCmd(rootCmd *cobra.Command, param cmdParam) {
if strings.Trim(cmdName, " ") == "" {
continue
}
runed, needExist := runGlobalCmd(cmdName)
if runed && needExist {
ran, needExist := runGlobalCmd(cmdName)
if ran && needExist {
break
}
if runed {
if ran {
continue
}
if err := runCustomCmd(cmdName); err != nil {
Expand Down

0 comments on commit 53834c9

Please sign in to comment.