fix(cli): preserve native option descriptions in help
Keep the optional address description visible to incur and describe the actual bundle plist default and absolute-path support. Extend the existing command help sweep instead of traversing the inventory a second time. Refs: #1418 Co-authored-by: Fazmin <fazmin.nizam@gmail.com>
This commit is contained in:
1 parent
95a77b6e25
commit
8b4c96e6c6
3 files changed
+8
-2
No files matched your search
@@ -188,7 +188,7 @@ export const registerCoreNativeCommands = (
|
||||
}),
|
||||
options: z.object({
|
||||
type: z.string().optional().describe("Exact database type category path"),
|
||||
address: z.string().describe("Exact native address").optional(),
|
||||
address: z.string().optional().describe("Exact native address"),
|
||||
"target-format": formatSelectionOption,
|
||||
provider: providerSelectionOption,
|
||||
}),
|
||||
|
||||
@@ -169,7 +169,7 @@ const registerNativeCommands = (
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Plist path relative to the app root (default: Contents/Info.plist)",
|
||||
"Plist path relative to the app root, or an absolute path (default: the bundle's Info.plist)",
|
||||
),
|
||||
}),
|
||||
run: ({ args, options }) =>
|
||||
|
||||
@@ -41,6 +41,7 @@ describe("CLI option aliases", () => {
|
||||
it("register only single-character short flags", async () => {
|
||||
const cli = createCli({});
|
||||
const invalid: string[] = [];
|
||||
const undescribed: string[] = [];
|
||||
for (const command of createCliInventory(cli).primary) {
|
||||
for (const [option, short] of Object.entries(
|
||||
registeredAliases(cli, command),
|
||||
@@ -52,8 +53,13 @@ describe("CLI option aliases", () => {
|
||||
const help = await serve(cli, [command, "--help"]);
|
||||
for (const match of help.stdout.matchAll(/(?:^|[\s,])-([a-z][\w-]+)/gmu))
|
||||
invalid.push(`${command} help: -${match[1] ?? ""}`);
|
||||
const options = /^Options:\n((?: {2}.*\n?)*)/mu.exec(help.stdout)?.[1];
|
||||
for (const line of options?.split("\n") ?? [])
|
||||
if (/^ {2}--\S+(?: <[^>]+>)?\s*$/u.test(line))
|
||||
undescribed.push(`${command} ${line.trim()}`);
|
||||
}
|
||||
expect(invalid).toEqual([]);
|
||||
expect(undescribed).toEqual([]);
|
||||
});
|
||||
|
||||
it("accepts kebab-case long options without registered aliases", async () => {
|
||||
|
||||
Reference in new issue
Block a user