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 100
100
raise (Bad (Ext_buffer. contents b))
101
101
102
102
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 =
105
104
let current = ref start in
106
105
let rev_list = ref [] in
107
- while ! current < l do
106
+ while ! current < finish do
108
107
let s = argv.(! current) in
109
108
incr current;
110
109
if s <> " " && s.[0 ] = '-' then begin
117
116
| Unit_call f -> f ()
118
117
end
119
118
| 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
121
120
else begin
122
121
let arg = argv.(! current) in
123
122
incr current;
Original file line number Diff line number Diff line change @@ -45,5 +45,6 @@ val parse_exn :
45
45
usage :string ->
46
46
argv :string array ->
47
47
start :int ->
48
+ ?finish : int ->
48
49
(key * spec * doc ) list ->
49
50
anon_fun -> unit
Original file line number Diff line number Diff line change @@ -1718,6 +1718,7 @@ val parse_exn :
1718
1718
usage:string ->
1719
1719
argv:string array ->
1720
1720
start:int ->
1721
+ ?finish:int ->
1721
1722
(key * spec * doc) list ->
1722
1723
anon_fun -> unit
1723
1724
end = struct
@@ -1824,11 +1825,10 @@ end = struct
1824
1825
raise (Bad (Ext_buffer.contents b))
1825
1826
1826
1827
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 =
1829
1829
let current = ref start in
1830
1830
let rev_list = ref [] in
1831
- while !current < l do
1831
+ while !current < finish do
1832
1832
let s = argv.(!current) in
1833
1833
incr current;
1834
1834
if s <> "" && s.[0] = '-' then begin
@@ -1841,7 +1841,7 @@ end = struct
1841
1841
| Unit_call f -> f ()
1842
1842
end
1843
1843
| 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
1845
1845
else begin
1846
1846
let arg = argv.(!current) in
1847
1847
incr current;
Original file line number Diff line number Diff line change @@ -1718,6 +1718,7 @@ val parse_exn :
1718
1718
usage:string ->
1719
1719
argv:string array ->
1720
1720
start:int ->
1721
+ ?finish:int ->
1721
1722
(key * spec * doc) list ->
1722
1723
anon_fun -> unit
1723
1724
end = struct
@@ -1824,11 +1825,10 @@ end = struct
1824
1825
raise (Bad (Ext_buffer.contents b))
1825
1826
1826
1827
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 =
1829
1829
let current = ref start in
1830
1830
let rev_list = ref [] in
1831
- while !current < l do
1831
+ while !current < finish do
1832
1832
let s = argv.(!current) in
1833
1833
incr current;
1834
1834
if s <> "" && s.[0] = '-' then begin
@@ -1841,7 +1841,7 @@ end = struct
1841
1841
| Unit_call f -> f ()
1842
1842
end
1843
1843
| 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
1845
1845
else begin
1846
1846
let arg = argv.(!current) in
1847
1847
incr current;
You can’t perform that action at this time.
0 commit comments