From d93c521b94bfcc2262a42e8c617ba23f92d327c6 Mon Sep 17 00:00:00 2001 From: techcenter68 Date: Sun, 17 May 2026 16:26:08 +0000 Subject: [PATCH] feat(browse): accept screenshot --clip=x,y,w,h (equals-sign syntax) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently \`screenshot --clip\` only accepts the space-separated form: browse screenshot --clip 100,200,300,400 out.png GNU long-option convention also supports the \`--flag=value\` form, which is handy when generating commands programmatically (no need to track whether the next argv element is the value or another flag) and matches what most CLI users expect. After this change, both work: browse screenshot --clip 100,200,300,400 out.png # existing, unchanged browse screenshot --clip=100,200,300,400 out.png # new Two-line change in the option parser. Existing space-separated callers and the error message ("Usage: screenshot --clip x,y,w,h [path]") are unchanged. Other flags in this handler (--viewport, --selector, --base64) keep their current single-form parsing — if folks want \`--viewport=\` etc. that's a worthwhile follow-up but feels out of scope for a one-flag patch. --- browse/src/meta-commands.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browse/src/meta-commands.ts b/browse/src/meta-commands.ts index c505d4cf4..8fec0ca2c 100644 --- a/browse/src/meta-commands.ts +++ b/browse/src/meta-commands.ts @@ -442,8 +442,8 @@ export async function handleMetaCommand( } else if (args[i] === '--selector') { flagSelector = args[++i]; if (!flagSelector) throw new Error('Usage: screenshot --selector [path]'); - } else if (args[i] === '--clip') { - const coords = args[++i]; + } else if (args[i] === '--clip' || args[i].startsWith('--clip=')) { + const coords = args[i] === '--clip' ? args[++i] : args[i].slice('--clip='.length); if (!coords) throw new Error('Usage: screenshot --clip x,y,w,h [path]'); const parts = coords.split(',').map(Number); if (parts.length !== 4 || parts.some(isNaN))