My agentic slop goes here. Not intended for anyone else!
1let run (xdg, cfg) =
2 Fmt.pr
3 "%a@.%a@.@.%a@.%a@."
4 Fmt.(styled `Bold string)
5 "=== Cmdliner Config ==="
6 Xdge.Cmd.pp
7 cfg
8 Fmt.(styled `Bold string)
9 "=== XDG Directories ==="
10 (Xdge.pp ~brief:false ~sources:true)
11 xdg
12;;
13
14open Cmdliner
15
16let () =
17 Fmt.set_style_renderer Fmt.stdout `Ansi_tty;
18 let app_name = "xdg_example" in
19 let doc = "Example program demonstrating XDG directory selection with Cmdliner" in
20 let man =
21 [ `S Manpage.s_description
22 ; `P
23 "This example shows how to use the Xdge library with Cmdliner to handle XDG Base \
24 Directory Specification paths with command-line and environment variable \
25 overrides."
26 ; `S Manpage.s_environment
27 ; `P (Xdge.Cmd.env_docs app_name)
28 ]
29 in
30 let info = Cmdliner.Cmd.info "xdg_example" ~version:"1.0" ~doc ~man in
31 Eio_main.run
32 @@ fun env ->
33 let create_xdg_term = Xdge.Cmd.term app_name env#fs () in
34 let main_term = Term.(const run $ create_xdg_term) in
35 let cmd = Cmdliner.Cmd.v info main_term in
36 exit @@ Cmdliner.Cmd.eval cmd
37;;