File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export default defineCommand({
3131 'minimax image generate --prompt "Mountain landscape" --quiet' ,
3232 ] ,
3333 async run ( config : Config , flags : GlobalFlags ) {
34- let prompt = flags . prompt as string | undefined ;
34+ let prompt = ( flags . prompt ?? ( flags . _positional as string [ ] | undefined ) ?. [ 0 ] ) as string | undefined ;
3535
3636 if ( ! prompt ) {
3737 if ( isInteractive ( { nonInteractive : config . nonInteractive } ) ) {
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export default defineCommand({
3131 'minimax search query --q "latest news" --output json' ,
3232 ] ,
3333 async run ( config : Config , flags : GlobalFlags ) {
34- const query = flags . q as string | undefined ;
34+ const query = ( flags . q ?? ( flags . _positional as string [ ] | undefined ) ?. [ 0 ] ) as string | undefined ;
3535
3636 if ( ! query ) {
3737 throw new CLIError (
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export default defineCommand({
3939 'minimax speech synthesize --text "Stream" --stream | mpv --no-terminal -' ,
4040 ] ,
4141 async run ( config : Config , flags : GlobalFlags ) {
42- let text = flags . text as string | undefined ;
42+ let text = ( flags . text ?? ( flags . _positional as string [ ] | undefined ) ?. [ 0 ] ) as string | undefined ;
4343
4444 if ( flags . textFile ) {
4545 const path = flags . textFile as string ;
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export default defineCommand({
5959 'minimax vision describe --file-id file-123456789 --prompt "Extract the text"' ,
6060 ] ,
6161 async run ( config : Config , flags : GlobalFlags ) {
62- let image = flags . image as string | undefined ;
62+ let image = ( flags . image ?? ( flags . _positional as string [ ] | undefined ) ?. [ 0 ] ) as string | undefined ;
6363 let fileId = flags . fileId as string | undefined ;
6464 const prompt = ( flags . prompt as string ) || 'Describe the image.' ;
6565
Original file line number Diff line number Diff line change @@ -77,6 +77,14 @@ class CommandRegistry {
7777 return { command : node . command , extra : commandPath . slice ( matched . length ) } ;
7878 }
7979
80+ // Single child: auto-forward (e.g. `minimax quota` → `minimax quota show`)
81+ if ( matched . length > 0 && node . children . size === 1 ) {
82+ const [ , child ] = node . children . entries ( ) . next ( ) . value as [ string , CommandNode ] ;
83+ if ( child . command ) {
84+ return { command : child . command , extra : commandPath . slice ( matched . length ) } ;
85+ }
86+ }
87+
8088 // If we matched some path but no command, show help for that group
8189 if ( matched . length > 0 && node . children . size > 0 ) {
8290 const subcommands = Array . from ( node . children . entries ( ) )
You can’t perform that action at this time.
0 commit comments