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

Commit 4ce024f

Browse files
committed
Fix completion
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 -- complete -p 0" will output only completion for the last option This commit fixes it
1 parent 3e61bab commit 4ce024f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Fargo/Fargo.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,13 @@ module Fargo =
386386
| Ok x, restx, usagex ->
387387
if not (Tokens.contains pos tokens) || Tokens.contains pos restx then
388388
let argy = f x
389-
argy.Complete pos restx
389+
let (cpx, ix) = argy.Complete pos restx
390+
let (cpy, iy) = arg.Complete pos tokens
391+
match ix,iy with
392+
| false, false -> cpx @ cpy, false
393+
| true, true -> cpx @ cpy, true
394+
| true, false -> cpx, true
395+
| false, true -> cpy, true
390396
else
391397
arg.Complete pos tokens
392398
| Error _, _, _ ->

0 commit comments

Comments
 (0)