@@ -143,7 +143,9 @@ func getSubCommands(includes []string) []cli.Command {
143
143
if len (include ) == 0 {
144
144
continue
145
145
}
146
- if include [0 ] != "/" [0 ] || include [0 ] != "~" [0 ] {
146
+ // If the include path is not absolute or a home directory path,
147
+ // prepend the source directory to make it relative to the config file.
148
+ if ! strings .HasPrefix (include , "/" ) && ! strings .HasPrefix (include , "~" ) {
147
149
include = filepath .Join (AhoyConf .srcDir , include )
148
150
}
149
151
if _ , err := os .Stat (include ); err != nil {
@@ -186,7 +188,7 @@ func getCommands(config Config) []cli.Command {
186
188
logger ("fatal" , "Command [" + name + "] has neither 'cmd' or 'imports' set. Check your yaml file." )
187
189
}
188
190
189
- // Check that a command has 'cmd' OR 'imports' set.
191
+ // Check that a command has 'cmd' AND 'imports' set.
190
192
if cmd .Cmd != "" && cmd .Imports != nil {
191
193
logger ("fatal" , "Command [" + name + "] has both 'cmd' and 'imports' set, but only one is allowed. Check your yaml file." )
192
194
}
@@ -262,7 +264,7 @@ func getCommands(config Config) []cli.Command {
262
264
newCmd .Subcommands = subCommands
263
265
}
264
266
265
- // log.Println("found command: ", name, " > ", cmd.Cmd)
267
+ // log.Println("Source file:", sourcefile, "- found command:", name, "> ", cmd.Cmd)
266
268
exportCmds = append (exportCmds , newCmd )
267
269
}
268
270
@@ -376,11 +378,12 @@ func NoArgsAction(c *cli.Context) {
376
378
}
377
379
378
380
if ! c .Bool ("help" ) || ! c .Bool ("version" ) {
379
- logger ("fatal" , "Missing flag or argument." )
381
+ logger ("warn" , "Missing flag or argument." )
382
+ os .Exit (1 )
380
383
}
381
384
382
- // Looks like we never reach here.
383
- fmt . Println ( "ERROR: NoArg Action " )
385
+ // Exit gracefully if we get to here.
386
+ os . Exit ( 0 )
384
387
}
385
388
386
389
// BeforeCommand runs before every command so arguments or flags must be passed
0 commit comments