Skip to content

Commit

Permalink
Optional imports
Browse files Browse the repository at this point in the history
  • Loading branch information
hanoii committed Feb 28, 2024
1 parent bc54cf5 commit df298a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ahoy.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Command struct {
Usage string
Cmd string
Hide bool
Optional bool
Imports []string
}

Expand Down Expand Up @@ -252,7 +253,11 @@ func getCommands(config Config) []cli.Command {
if cmd.Imports != nil {
subCommands := getSubCommands(cmd.Imports)
if len(subCommands) == 0 {
logger("fatal", "Command ["+name+"] has 'imports' set, but no commands were found. Check your yaml file.")
if !cmd.Optional {
logger("fatal", "Command ["+name+"] has 'imports' set, but no commands were found. Check your yaml file.")
} else {
continue
}
}
newCmd.Subcommands = subCommands
}
Expand Down

0 comments on commit df298a9

Please sign in to comment.