diff --git a/packages/core/src/parameter/scanner.ts b/packages/core/src/parameter/scanner.ts index daafe25..7b78e2f 100644 --- a/packages/core/src/parameter/scanner.ts +++ b/packages/core/src/parameter/scanner.ts @@ -439,7 +439,7 @@ function findFlagsByArgument( return []; } -const FLAG_NAME_VALUE_PATTERN = /^--([a-z][a-z-]+)=(.+)$/i; +const FLAG_NAME_VALUE_PATTERN = /^--([a-z][a-z-\.]+)=(.+)$/i; const ALIAS_VALUE_PATTERN = /^-([a-z])=(.+)$/i; /** diff --git a/packages/core/tests/baselines/reference/parameter/flag/formatting.txt b/packages/core/tests/baselines/reference/parameter/flag/formatting.txt index 8fdbad7..38687e6 100644 --- a/packages/core/tests/baselines/reference/parameter/flag/formatting.txt +++ b/packages/core/tests/baselines/reference/parameter/flag/formatting.txt @@ -44,6 +44,10 @@ :::: formatDocumentationForFlagParameters / no flags -h --help Print help information and exit  -- All subsequent inputs should be interpreted as arguments +:::: formatDocumentationForFlagParameters / parsed / multipart flag + --multi.part required parsed flag +-h --help Print help information and exit + -- All subsequent inputs should be interpreted as arguments :::: formatDocumentationForFlagParameters / parsed / multiple parsed flags  --requiredParsed required parsed flag  --requiredParsedWithLongerName required parsed flag with longer name diff --git a/packages/core/tests/parameter/flag/formatting.spec.ts b/packages/core/tests/parameter/flag/formatting.spec.ts index 3865c3a..7a1ee7b 100644 --- a/packages/core/tests/parameter/flag/formatting.spec.ts +++ b/packages/core/tests/parameter/flag/formatting.spec.ts @@ -728,5 +728,30 @@ describe("formatDocumentationForFlagParameters", function () { // THEN compareToBaseline(this, StringArrayBaselineFormat, lines); }); + + it("multipart flag", function () { + // GIVEN + type Positional = []; + type Flags = { + readonly "multi.part": string; + }; + + const parameters: TypedCommandParameters = { + flags: { + "multi.part": { + kind: "parsed", + parse: String, + brief: "required parsed flag", + }, + }, + positional: { kind: "tuple", parameters: [] }, + }; + + // WHEN + const lines = formatDocumentationForFlagParameters(parameters.flags, parameters.aliases ?? {}, defaultArgs); + + // THEN + compareToBaseline(this, StringArrayBaselineFormat, lines); + }); }); });