Skip to content

Commit e357d8a

Browse files
committed
fix(arg-parsing): trim whitespace in parseOrgPrefixedArg for consistency
1 parent 2aaea2f commit e357d8a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/lib/arg-parsing.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,15 @@ export function parseOrgPrefixedArg(
267267
resourceLabel: string,
268268
usageHint: string
269269
): ParsedOrgPrefixed {
270-
if (!arg.includes("/")) {
271-
return { name: arg };
270+
const trimmed = arg.trim();
271+
272+
if (!trimmed.includes("/")) {
273+
return { name: trimmed };
272274
}
273275

274-
const slashIndex = arg.indexOf("/");
275-
const org = arg.slice(0, slashIndex);
276-
const name = arg.slice(slashIndex + 1);
276+
const slashIndex = trimmed.indexOf("/");
277+
const org = trimmed.slice(0, slashIndex);
278+
const name = trimmed.slice(slashIndex + 1);
277279

278280
if (!(org && name)) {
279281
throw new ContextError(

0 commit comments

Comments
 (0)