Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: assume Cmdliner.Arg.conv is abstract #6609

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bin/arg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ module Dep = struct

let parser s =
match parse_alias s with
| Some dep -> `Ok dep
| Some dep -> Ok dep
| None -> (
match
Dune_lang.Decoder.parse dep_parser Univ_map.empty
(Dune_lang.Parser.parse_string ~fname:"command line"
~mode:Dune_lang.Parser.Mode.Single s)
with
| x -> `Ok x
| exception User_error.E msg -> `Error (User_message.to_string msg))
| x -> Ok x
| exception User_error.E msg -> Error (User_message.to_string msg))

let string_of_alias ~recursive sv =
let prefix = if recursive then "@" else "@@" in
Expand All @@ -88,7 +88,7 @@ module Dep = struct
in
Format.pp_print_string ppf s

let conv = (parser, printer)
let conv = conv' (parser, printer)

let to_string_maybe_quoted t =
String.maybe_quoted (Format.asprintf "%a" printer t)
Expand Down
11 changes: 6 additions & 5 deletions bin/install_uninstall.ml
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,12 @@ let install_uninstall ~what =
let doc = Format.asprintf "%a packages." pp_what what in
let name_ = Arg.info [] ~docv:"PACKAGE" in
let absolute_path =
( (fun path ->
if Filename.is_relative path then
`Error "the path must be absolute to avoid ambiguity"
else `Ok path)
, snd Arg.string )
Arg.conv'
( (fun path ->
if Filename.is_relative path then
Error "the path must be absolute to avoid ambiguity"
else Ok path)
, Arg.conv_printer Arg.string )
in
let term =
let+ common = Common.term
Expand Down