File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,14 @@ function collateSpacedCmdIDFromArgs(argv: string[], config: IConfig): string[] {
4848 const finalizeId = ( s ?: string ) => s ? [ ...final , s ] . join ( ':' ) : final . join ( ':' )
4949
5050 const hasSubCommandsWithArgs = ( ) => {
51- const subCommands = config . commands . filter ( c => ( c . id ) . startsWith ( finalizeId ( ) ) )
51+ const id = finalizeId ( )
52+ /**
53+ * Get a list of sub commands for the current command id. A command is returned as a subcommand under either
54+ * of these conditions:
55+ * 1. the `id` start with the current command id.
56+ * 2. any of the aliases start with the current command id.
57+ */
58+ const subCommands = config . commands . filter ( c => ( c . id ) . startsWith ( id ) || c . aliases . some ( a => a . startsWith ( id ) ) )
5259 return Boolean ( subCommands . find ( cmd => cmd . strict === false || cmd . args ?. length > 0 ) )
5360 }
5461
You can’t perform that action at this time.
0 commit comments