Skip to content
New issue

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

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

Already on GitHub? # to your account

Proof of concept of manpage generation #11

Merged
merged 1 commit into from
Jan 31, 2025
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
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
Loading