Skip to content

Commit e86aa53

Browse files
extend .GetTag method to also accept expr constructors
1 parent e743e65 commit e86aa53

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### 3.0.0-alpha002
1+
### 3.0.0-alpha003
22
* Add subcommand support.
33
* Add support for list and option parameters.
44
* Add support for grouped switches.

src/Argu/ArgumentParser.fs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ type ArgumentParser<'Template when 'Template :> IArgParserTemplate> private (arg
154154
let tag = argInfo.TagReader.Value (value :> obj)
155155
argInfo.Cases.[tag].UnionCaseInfo
156156

157+
/// <summary>
158+
/// Gets the F# union tag representation for given union case constructor
159+
/// </summary>
160+
/// <param name="ctorExpr">Quoted union case constructor.</param>
161+
member __.GetTag(ctorExpr : Expr<'Fields -> 'Template>) : UnionCaseInfo =
162+
expr2Uci ctorExpr
163+
157164
/// <summary>
158165
/// Prints command line syntax. Useful for generating documentation.
159166
/// </summary>

0 commit comments

Comments
 (0)