Client: help generation fixes.

This commit is contained in:
Benjamin Canou 2016-12-05 13:18:12 +01:00
parent a098d25a55
commit 923d061d72
2 changed files with 6 additions and 6 deletions

View File

@ -177,18 +177,18 @@ module Alias = functor (Entity : Entity) -> struct
include Entity include Entity
let alias_param ?(name = "name") ?(desc = "existing " ^ name ^ " alias") next = let alias_param ?(name = "name") ?(desc = "existing " ^ Entity.name ^ " alias") next =
param ~name ~desc param ~name ~desc
(fun cctxt s -> find cctxt s >>= fun v -> return (s, v)) (fun cctxt s -> find cctxt s >>= fun v -> return (s, v))
next next
let fresh_alias_param ?(name = "new") ?(desc = "new " ^ name ^ " alias") next = let fresh_alias_param ?(name = "new") ?(desc = "new " ^ Entity.name ^ " alias") next =
param ~name ~desc param ~name ~desc
(fun cctxt s -> (fun cctxt s ->
load cctxt >>= fun list -> load cctxt >>= fun list ->
if not Client_config.force#get then if not Client_config.force#get then
Lwt_list.iter_s (fun (n, _v) -> Lwt_list.iter_s (fun (n, _v) ->
if n = name then if n = s then
cctxt.Client_commands.error cctxt.Client_commands.error
"the %s alias %s already exists, use -force true to update" Entity.name n "the %s alias %s already exists, use -force true to update" Entity.name n
else return ()) else return ())
@ -197,7 +197,7 @@ module Alias = functor (Entity : Entity) -> struct
else return s) else return s)
next next
let source_param ?(name = "src") ?(desc = "source " ^ name) next = let source_param ?(name = "src") ?(desc = "source " ^ Entity.name) next =
let desc = let desc =
desc ^ "\n" desc ^ "\n"
^ "can be an alias, file or literal (autodetected in this order)\n\ ^ "can be an alias, file or literal (autodetected in this order)\n\

View File

@ -291,12 +291,12 @@ let usage
Format.pp_print_text desc Format.pp_print_text desc
help_args params ; help_args params ;
end ; end ;
if options = [] then if args = [] then
Format.fprintf ppf "@]" Format.fprintf ppf "@]"
else else
Format.fprintf ppf "@,%a@]" Format.fprintf ppf "@,%a@]"
(Format.pp_print_list option_help) (Format.pp_print_list option_help)
options in args in
let rec group_help ppf ({ title }, commands) = let rec group_help ppf ({ title }, commands) =
Format.fprintf ppf "@[<v 2>%s:@,%a@]" Format.fprintf ppf "@[<v 2>%s:@,%a@]"
title title