Skip to content

Commit

Permalink
Jsoo: more robust flag parsing
Browse files Browse the repository at this point in the history
Signed-off-by: Hugo Heuzard <hugo.heuzard@gmail.com>
  • Loading branch information
hhugo committed Jan 23, 2023
1 parent 23e09fd commit fdfea33
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/dune_rules/jsoo/jsoo_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,17 @@ end = struct
let rec loop acc = function
| [] -> acc
| "--enable" :: name :: rest -> loop (set acc name true) rest
| maybe_enable :: rest
when String.starts_with maybe_enable ~prefix:"--enable=" -> (
match String.drop_prefix maybe_enable ~prefix:"--enable=" with
| Some name -> loop (set acc name true) rest
| _ -> assert false)
| "--disable" :: name :: rest -> loop (set acc name false) rest
| maybe_disable :: rest
when String.starts_with maybe_disable ~prefix:"--disable=" -> (
match String.drop_prefix maybe_disable ~prefix:"--disable=" with
| Some name -> loop (set acc name false) rest
| _ -> assert false)
| _ :: rest -> loop acc rest
in
loop default l
Expand Down

0 comments on commit fdfea33

Please sign in to comment.