@@ -275,11 +275,11 @@ map2 (fun firstName lastName -> firstName + " " + lastName)
275
275
// Arg<string>
276
276
```
277
277
278
- Is is clearer to use the applicative computation expression ` cmdLine ` instead:
278
+ Is is clearer to use the applicative computation expression ` fargo ` instead:
279
279
``` fsharp
280
- cmdLine {
281
- let! firstName = arg "first-name" "f" " The user firstname" |> reqArg
282
- and! lastName = arg "last-name" "l" " The user last name" |> reqArg
280
+ fargo {
281
+ let! firstName = arg "first-name" "The user firstname" |> reqArg
282
+ and! lastName = arg "last-name" "The user last name" |> reqArg
283
283
return firstName + " " + lastName
284
284
} // Arg<string>
285
285
```
@@ -290,10 +290,10 @@ type User =
290
290
LastName string
291
291
Age: int option }
292
292
293
- cmdLine {
294
- let! firstName = arg "first-name" "f" " The user firstname" |> reqArg
295
- and! lastName = arg "last-name" "l" " The user last name" |> reqArg
296
- and! age = arg "age" "a " "The user age" |> optParse tryParseInt
293
+ fargo {
294
+ let! firstName = arg "first-name" "The user firstname" |> reqArg
295
+ and! lastName = arg "last-name" "The user last name" |> reqArg
296
+ and! age = opt "age" null "age " "The user age" |> optParse tryParseInt
297
297
return { FirstName = firstName
298
298
LastName = lastName
299
299
Age = age }
@@ -351,7 +351,7 @@ type FileCmd = Load | Save
351
351
type Command =
352
352
| Load of string
353
353
| Save of string * bool
354
- cmdLine {
354
+ fargo {
355
355
match! (cmd "load" "ld" "loads the document" |~> FileCmd.Load)
356
356
<|> (cmd "save" "sv" "saves the document" |~> FileCmd.Save)
357
357
<|> (error "Invalid file command") with
@@ -372,7 +372,7 @@ Since commands return their name, it is possible to match directly on it:
372
372
type Command =
373
373
| Load of string
374
374
| Save of string * bool
375
- cmdLine {
375
+ fargo {
376
376
match! cmd "load" "ld" "loads the document"
377
377
<|> cmd "save" "sv" "saves the document" with
378
378
| "load" ->
@@ -392,7 +392,7 @@ type Command =
392
392
| Load of string
393
393
| Save of string * bool
394
394
| Touch of string
395
- cmdLine {
395
+ fargo {
396
396
match! cmd "load" "ld" "loads the document"
397
397
<|> cmd "save" "sv" "saves the document" with
398
398
| "load" ->
@@ -420,7 +420,7 @@ type Command =
420
420
| Load of string
421
421
| Save of string * bool
422
422
| Touch of string
423
- cmdLine {
423
+ fargo {
424
424
match! (cmd "load" "ld" "loads the document" |~> FileCmd.Load)
425
425
<|> (cmd "save" "sv" "saves the document" |~> FileCmd.Save)
426
426
<|> (ret FileCmd.Touch) with
0 commit comments