Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 803ccdc

Browse files
committed
Fix usage
Example let test = fargo { let! opta = opt "a" "a" "a" "a" let! optb = opt "b" "b" "b" "b" let! optc = opt "c" "c" "c" "c" return opta, optb, optc } "dotnet run -- --help" will contain help message only for the last option This commit fixes it
1 parent 4ce024f commit 803ccdc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Fargo/Fargo.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ module Usage =
8989
module Fargo =
9090
let cmd name alt description: Arg<string> =
9191
let usage = { Name = Some name; Alt = Option.ofObj alt; Value = None; Description = description; Help = None; Type = UsageType.Required }
92-
let matchusages = { Path = [ usage ]; Options = [usage]}
92+
let matchusages = { Path = [ usage ]; Options = []}
9393
let failusages = { Path = []; Options = [usage]}
9494
let notFound = Error [$"Command %s{name} not found"]
9595
{ Parse =
@@ -377,7 +377,7 @@ module Fargo =
377377
| Ok x, restx, usagex ->
378378
let argy = f x
379379
let y, resty, usagey = argy.Parse restx
380-
y, resty, { Path = usagey.Path @ usagex.Path; Options = usagey.Options}
380+
y, resty, { Path = usagey.Path @ usagex.Path; Options = usagey.Options @ usagex.Options}
381381
| Error ex, restx, usagex ->
382382
Error ex, restx, usagex
383383
Complete =
@@ -550,7 +550,7 @@ module Run =
550550
usages.Options
551551
|> List.filter (fun u -> not (u.Name = None || u.IsRequired))
552552

553-
if cmds <> [] then printfn "[command]"
553+
if cmds <> [] then printf "[command] "
554554
if opts <> [] then printf "[options] "
555555
for u in args do
556556
if u.IsArg then

0 commit comments

Comments
 (0)