Skip to content

Commit

Permalink
Proof of concept of manpage generation
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Sherratt <[email protected]>
  • Loading branch information
gridbugs committed Jan 31, 2025
1 parent 8b8a6b1 commit 41e4ed7
Show file tree
Hide file tree
Showing 12 changed files with 239 additions and 46 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

- Allow help messages colours to be configured (#7)
- Proof of concept of manpage generation (#11)

### Changed

Expand All @@ -16,6 +17,7 @@

- Remove superfluous style reset escape sequences (#7)
- Don't apply formatting to trailing spaces in argument names in help messages (#8)
- Print a readable error when the argument spec is invalid (#10)

## 0.3.0

Expand Down
4 changes: 3 additions & 1 deletion examples/echo_ansi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ let () =
; arg_desc = { ansi_style_plain with color = Some `Cyan }
}
in
match Command.run ~help_style command with
match
Command.run ~program_name:(Literal "echo-ansi") ~version:"0.0.1" ~help_style command
with
| `Completion -> print_endline (Command.completion_script_bash command)
| `Main main -> main ()
;;
6 changes: 5 additions & 1 deletion examples/fake_git.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ let commit =
let log =
let open Arg_parser in
let+ _pretty =
named_opt [ "pretty"; "p" ] (string_enum [ "full"; "fuller"; "short"; "oneline" ])
named_opt
[ "pretty"; "p" ]
(string_enum [ "full"; "fuller"; "short"; "oneline" ])
~desc:"foo"
in
()
;;
Expand All @@ -61,6 +64,7 @@ let bisect_common =
let () =
let open Command in
group
~prose:(Manpage.prose ~description:[] ())
~desc:"Fake version control"
[ subcommand "config" (singleton Arg_parser.unit ~desc:"Configure the tool.")
; subcommand "checkout" (singleton checkout ~desc:"Check out a revision.")
Expand Down
1 change: 1 addition & 0 deletions src/climate/built_in.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open! Import

let help_names : _ Nonempty_list.t = [ Name.of_string_exn "help"; Name.of_string_exn "h" ]
let manpage_names : _ Nonempty_list.t = [ Name.of_string_exn "manpage" ]
1 change: 1 addition & 0 deletions src/climate/built_in.mli
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open! Import

val help_names : Name.t Nonempty_list.t
val manpage_names : Name.t Nonempty_list.t
Loading

0 comments on commit 41e4ed7

Please sign in to comment.