Client: restore automatic verbosity in man
This commit is contained in:
parent
329e13cefa
commit
6063f67992
@ -326,7 +326,7 @@ let rec help_commands commands =
|
|||||||
unless [-verbosity <2|3>] is passed or the list \
|
unless [-verbosity <2|3>] is passed or the list \
|
||||||
of matching commands if less than 3."
|
of matching commands if less than 3."
|
||||||
(args2
|
(args2
|
||||||
(default_arg
|
(arg
|
||||||
~doc:"level of details\n\
|
~doc:"level of details\n\
|
||||||
0. Only shows command mnemonics, without documentation.\n\
|
0. Only shows command mnemonics, without documentation.\n\
|
||||||
1. Shows command mnemonics with short descriptions.\n\
|
1. Shows command mnemonics with short descriptions.\n\
|
||||||
@ -334,7 +334,6 @@ let rec help_commands commands =
|
|||||||
3. Show everything"
|
3. Show everything"
|
||||||
~parameter:"-verbosity"
|
~parameter:"-verbosity"
|
||||||
~placeholder:"0|1|2|3"
|
~placeholder:"0|1|2|3"
|
||||||
~default: "1"
|
|
||||||
(parameter
|
(parameter
|
||||||
~autocomplete: (fun _ -> return [ "0" ; "1" ; "2" ; "3" ])
|
~autocomplete: (fun _ -> return [ "0" ; "1" ; "2" ; "3" ])
|
||||||
(fun _ arg -> match arg with
|
(fun _ arg -> match arg with
|
||||||
@ -360,13 +359,16 @@ let rec help_commands commands =
|
|||||||
~desc:"keyword to search for\n\
|
~desc:"keyword to search for\n\
|
||||||
If several are given they must all appear in the command.")))
|
If several are given they must all appear in the command.")))
|
||||||
(fun (verbosity, format) keywords _ ->
|
(fun (verbosity, format) keywords _ ->
|
||||||
fail (Help_cmd (keywords,
|
let commands =
|
||||||
List.fold_left
|
List.fold_left
|
||||||
(fun commands keyword -> List.filter (search_command keyword) commands)
|
(fun commands keyword -> List.filter (search_command keyword) commands)
|
||||||
(help_commands [] @ commands)
|
(help_commands [] @ commands)
|
||||||
keywords,
|
keywords in
|
||||||
format,
|
let verbosity = match verbosity with
|
||||||
verbosity))) ]
|
| Some verbosity -> verbosity
|
||||||
|
| None when List.length commands <= 3 -> `Full
|
||||||
|
| None -> `Short in
|
||||||
|
fail (Help_cmd (keywords, commands, format, verbosity))) ]
|
||||||
|
|
||||||
(* Command execution *)
|
(* Command execution *)
|
||||||
let exec
|
let exec
|
||||||
@ -871,9 +873,7 @@ let setup_ppf ppf format verbosity =
|
|||||||
.cmdline { background: #343131; padding: 2px 8px; border-radius:10px; color: white; margin: 5px; }\
|
.cmdline { background: #343131; padding: 2px 8px; border-radius:10px; color: white; margin: 5px; }\
|
||||||
.cmdline+.cmddoc { margin: -5px 5px 0 20px; padding: 5px }\
|
.cmdline+.cmddoc { margin: -5px 5px 0 20px; padding: 5px }\
|
||||||
.opt,.arg { background: #343131; font-weight: bold; padding: 2px 4px; border-radius:5px; }\
|
.opt,.arg { background: #343131; font-weight: bold; padding: 2px 4px; border-radius:5px; }\
|
||||||
.kwd { font-weight: bold; }\
|
.kwd { font-weight: bold; } .opt { color:#CF0; background: #460; } .arg { color: #CEF; background: #369; }\
|
||||||
.opt { color:#CF0; background: #460; }\
|
|
||||||
.arg { color: #CEF; background: #369; }\
|
|
||||||
\003/style\004@\n" ;
|
\003/style\004@\n" ;
|
||||||
| _ -> Pervasives.failwith "Cli_entries: invalid semantic tag"
|
| _ -> Pervasives.failwith "Cli_entries: invalid semantic tag"
|
||||||
end ;
|
end ;
|
||||||
|
Loading…
Reference in New Issue
Block a user