File tree Expand file tree Collapse file tree 4 files changed +12
-12
lines changed Expand file tree Collapse file tree 4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 100100 raise (Bad (Ext_buffer. contents b))
101101
102102
103- let parse_exn ~usage ~argv ~start (speclist : t ) anonfun =
104- let l = Array. length argv in
103+ let parse_exn ~usage ~argv ~start ?(finish =Array. length argv) (speclist : t ) anonfun =
105104 let current = ref start in
106105 let rev_list = ref [] in
107- while ! current < l do
106+ while ! current < finish do
108107 let s = argv.(! current) in
109108 incr current;
110109 if s <> " " && s.[0 ] = '-' then begin
117116 | Unit_call f -> f ()
118117 end
119118 | String f ->
120- if ! current > = l then stop_raise ~usage ~error: (Missing s) speclist
119+ if ! current > = finish then stop_raise ~usage ~error: (Missing s) speclist
121120 else begin
122121 let arg = argv.(! current) in
123122 incr current;
Original file line number Diff line number Diff line change @@ -45,5 +45,6 @@ val parse_exn :
4545 usage :string ->
4646 argv :string array ->
4747 start :int ->
48+ ?finish : int ->
4849 (key * spec * doc ) list ->
4950 anon_fun -> unit
Original file line number Diff line number Diff line change @@ -1718,6 +1718,7 @@ val parse_exn :
17181718 usage:string ->
17191719 argv:string array ->
17201720 start:int ->
1721+ ?finish:int ->
17211722 (key * spec * doc) list ->
17221723 anon_fun -> unit
17231724end = struct
@@ -1824,11 +1825,10 @@ end = struct
18241825 raise (Bad (Ext_buffer.contents b))
18251826
18261827
1827- let parse_exn ~usage ~argv ~start (speclist : t) anonfun =
1828- let l = Array.length argv in
1828+ let parse_exn ~usage ~argv ~start ?(finish=Array.length argv) (speclist : t) anonfun =
18291829 let current = ref start in
18301830 let rev_list = ref [] in
1831- while !current < l do
1831+ while !current < finish do
18321832 let s = argv.(!current) in
18331833 incr current;
18341834 if s <> "" && s.[0] = '-' then begin
@@ -1841,7 +1841,7 @@ end = struct
18411841 | Unit_call f -> f ()
18421842 end
18431843 | String f ->
1844- if !current >= l then stop_raise ~usage ~error:(Missing s) speclist
1844+ if !current >= finish then stop_raise ~usage ~error:(Missing s) speclist
18451845 else begin
18461846 let arg = argv.(!current) in
18471847 incr current;
Original file line number Diff line number Diff line change @@ -1718,6 +1718,7 @@ val parse_exn :
17181718 usage:string ->
17191719 argv:string array ->
17201720 start:int ->
1721+ ?finish:int ->
17211722 (key * spec * doc) list ->
17221723 anon_fun -> unit
17231724end = struct
@@ -1824,11 +1825,10 @@ end = struct
18241825 raise (Bad (Ext_buffer.contents b))
18251826
18261827
1827- let parse_exn ~usage ~argv ~start (speclist : t) anonfun =
1828- let l = Array.length argv in
1828+ let parse_exn ~usage ~argv ~start ?(finish=Array.length argv) (speclist : t) anonfun =
18291829 let current = ref start in
18301830 let rev_list = ref [] in
1831- while !current < l do
1831+ while !current < finish do
18321832 let s = argv.(!current) in
18331833 incr current;
18341834 if s <> "" && s.[0] = '-' then begin
@@ -1841,7 +1841,7 @@ end = struct
18411841 | Unit_call f -> f ()
18421842 end
18431843 | String f ->
1844- if !current >= l then stop_raise ~usage ~error:(Missing s) speclist
1844+ if !current >= finish then stop_raise ~usage ~error:(Missing s) speclist
18451845 else begin
18461846 let arg = argv.(!current) in
18471847 incr current;
You can’t perform that action at this time.
0 commit comments