@@ -275,11 +275,11 @@ map2 (fun firstName lastName -> firstName + " " + lastName)
275275 // Arg<string>
276276```
277277
278- Is is clearer to use the applicative computation expression ` cmdLine ` instead:
278+ Is is clearer to use the applicative computation expression ` fargo ` instead:
279279``` 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
283283 return firstName + " " + lastName
284284} // Arg<string>
285285```
@@ -290,10 +290,10 @@ type User =
290290 LastName string
291291 Age: int option }
292292
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
297297 return { FirstName = firstName
298298 LastName = lastName
299299 Age = age }
@@ -351,7 +351,7 @@ type FileCmd = Load | Save
351351type Command =
352352| Load of string
353353| Save of string * bool
354- cmdLine {
354+ fargo {
355355 match! (cmd "load" "ld" "loads the document" |~> FileCmd.Load)
356356 <|> (cmd "save" "sv" "saves the document" |~> FileCmd.Save)
357357 <|> (error "Invalid file command") with
@@ -372,7 +372,7 @@ Since commands return their name, it is possible to match directly on it:
372372type Command =
373373| Load of string
374374| Save of string * bool
375- cmdLine {
375+ fargo {
376376 match! cmd "load" "ld" "loads the document"
377377 <|> cmd "save" "sv" "saves the document" with
378378 | "load" ->
@@ -392,7 +392,7 @@ type Command =
392392| Load of string
393393| Save of string * bool
394394| Touch of string
395- cmdLine {
395+ fargo {
396396 match! cmd "load" "ld" "loads the document"
397397 <|> cmd "save" "sv" "saves the document" with
398398 | "load" ->
@@ -420,7 +420,7 @@ type Command =
420420| Load of string
421421| Save of string * bool
422422| Touch of string
423- cmdLine {
423+ fargo {
424424 match! (cmd "load" "ld" "loads the document" |~> FileCmd.Load)
425425 <|> (cmd "save" "sv" "saves the document" |~> FileCmd.Save)
426426 <|> (ret FileCmd.Touch) with
0 commit comments