Skip to content

Commit b4af3c0

Browse files
RyanLee-Devclaude
andcommitted
feat: accept positional arg as primary input for single-subcommand groups
First positional arg falls back to the primary flag when --flag is omitted: minimax image "A cat in space" → image generate --prompt minimax search "MiniMax AI" → search query --q minimax vision photo.jpg → vision describe --image minimax speech "Hello" → speech synthesize --text (when routed) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 465967b commit b4af3c0

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/commands/image/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 })) {

src/commands/search/query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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(

src/commands/speech/synthesize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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;

src/commands/vision/describe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)