Skip to content

Commit

Permalink
Move custom args to Arg submodule
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
  • Loading branch information
rgrinberg committed Jul 11, 2018
1 parent fb70a4d commit 6e352ae
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,17 @@ let find_root () =
in
(dir, to_cwd)

let package_name =
Arg.conv ((fun p -> Ok (Package.Name.of_string p)), Package.Name.pp)
module Arg = struct
include Arg

let path_arg =
Arg.conv ((fun p -> Ok (Path.of_filename_relative_to_initial_cwd p))
, Path.pp
)
let package_name =
Arg.conv ((fun p -> Ok (Package.Name.of_string p)), Package.Name.pp)

let path =
Arg.conv ((fun p -> Ok (Path.of_filename_relative_to_initial_cwd p))
, Path.pp
)
end

let common_footer =
`Blocks
Expand Down Expand Up @@ -436,7 +440,7 @@ let common =
in
let workspace_file =
Arg.(value
& opt (some path_arg) None
& opt (some path) None
& info ["workspace"] ~docs ~docv:"FILE"
~doc:"Use this specific workspace file instead of looking it up.")
in
Expand Down Expand Up @@ -473,7 +477,7 @@ let common =
let config_file =
let config_file =
Arg.(value
& opt (some path_arg) None
& opt (some path) None
& info ["config-file"] ~docs ~docv:"FILE"
~doc:"Load this configuration file instead of the default one.")
in
Expand Down

0 comments on commit 6e352ae

Please sign in to comment.