From 2161ee9bd8826492ca9c400744ed5e3b51857e37 Mon Sep 17 00:00:00 2001 From: Andrey Popp Date: Sat, 8 Jun 2024 22:24:26 +0400 Subject: [PATCH] Try pos args left to right when parsing command line This doesn't affect how arguments are evaluated as each pos arg parse only looks at the own range of argv but it does affect which arg's completion is going to be used. --- src/cmdliner_cline.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmdliner_cline.ml b/src/cmdliner_cline.ml index f7f0b55..132a94a 100644 --- a/src/cmdliner_cline.ml +++ b/src/cmdliner_cline.ml @@ -39,7 +39,7 @@ let arg_info_indexes args = their arg_info, a list with all arg_info for positional arguments and a cmdline mapping each arg_info to an empty [arg]. *) let rec loop optidx posidx cl = function - | [] -> optidx, posidx, cl + | [] -> optidx, List.rev posidx, cl | a :: l -> match Cmdliner_info.Arg.is_pos a with | true -> loop optidx (a :: posidx) (Amap.add a (P []) cl) l