File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,35 @@ int Main(string[] args) {
145
145
}
146
146
```
147
147
148
+ ** F#:**
149
+ ``` fsharp
150
+ open CommandLine
151
+
152
+ [<Verb("add", HelpText = "Add file contents to the index.")>]
153
+ type AddOptions = {
154
+ // normal options here
155
+ }
156
+ [<Verb("commit", HelpText = "Record changes to the repository.")>]
157
+ type CommitOptions = {
158
+ // normal options here
159
+ }
160
+ [<Verb("clone", HelpText = "Clone a repository into a new directory.")>]
161
+ type CloneOptions = {
162
+ // normal options here
163
+ }
164
+
165
+ [<EntryPoint>]
166
+ let main args =
167
+ let result = Parser.Default.ParseArguments<AddOptions, CommitOptions, CloneOptions> args
168
+ match result with
169
+ | :? CommandLine.Parsed<obj> as command ->
170
+ match command.Value with
171
+ | :? AddOptions as opts -> RunAddAndReturnExitCode opts
172
+ | :? CommitOptions as opts -> RunCommitAndReturnExitCode opts
173
+ | :? CloneOptions as opts -> RunCloneAndReturnExitCode opts
174
+ | :? CommandLine.NotParsed<obj> -> 1
175
+ ```
176
+
148
177
Acknowledgements:
149
178
---
150
179
[ ![ Jet Brains ReSharper] ( /art/resharper-logo.png )] ( http://www.jetbrains.com/resharper/ )
You can’t perform that action at this time.
0 commit comments