From 333edd1b31381b2cc86b57298b16a592eb001122 Mon Sep 17 00:00:00 2001 From: Ruben Bartelink Date: Mon, 19 Feb 2024 11:02:18 +0000 Subject: [PATCH] feat(ArgumentParser): Expose ProgramName (#229) --- RELEASE_NOTES.md | 3 +++ src/Argu/ArgumentParser.fs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index df4d9ee3..b49242c9 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +### 6.2.0 +* Add `ParseResults.ProgramName` [#229](https://github.com/fsprojects/Argu/pull/229) + ### 6.1.5 * Fix the regression of the [#127](https://github.com/fsprojects/Argu/pull/127) merged in 6.1.2 and fix Mandatory arguments in nested subcommands. [#220](https://github.com/fsprojects/Argu/issues/220) [@fpellet](https://github.com/fpellet) diff --git a/src/Argu/ArgumentParser.fs b/src/Argu/ArgumentParser.fs index 954be434..ebf693d2 100644 --- a/src/Argu/ArgumentParser.fs +++ b/src/Argu/ArgumentParser.fs @@ -115,6 +115,9 @@ and [] | _ -> argInfoWithCheck.Value new ArgumentParser<'Template>(argInfo, programName, helpTextMessage, usageStringCharacterWidth, errorHandler) + /// The Program Name, as used when rendering help messages. Can be overridden via the programName constructor argument. + member val ProgramName = _programName + /// Force a check of the discriminated union structure. static member CheckStructure() = argInfoWithCheck.Value |> ignore @@ -284,4 +287,4 @@ module ArgumentParserUtils = /// gets the F# union tag representation of given argument instance let tagOf (input : 'Template) : int = - ArgumentParser.Create<'Template>().GetTag input \ No newline at end of file + ArgumentParser.Create<'Template>().GetTag input