@@ -17,14 +17,20 @@ module Cli = struct
1717 type strategy =
1818 { installables : string list
1919 ; target_info : target_info
20+ ; printcmd : bool
2021 }
2122
2223 (* * Positional URI arguments passed to the program via the command line. *)
2324 let uris = Arg. (value & pos_all dirpath [] & info [] )
2425
26+ let printcmd =
27+ let doc = " Print the command to stdout instead of executing it." in
28+ Arg. (value & flag & info [ " printcmd" ] ~doc )
29+ ;;
30+
2531 (* * Processes the args so that the main function knows what to do with them. *)
2632 let make_strategy =
27- let build original_args =
33+ let build original_args printcmd =
2834 let installables, target_info =
2935 let default_installables = []
3036 and default_target =
@@ -81,9 +87,9 @@ module Cli = struct
8187 , { entrypoint = None ; attribute = None ; subshell_dir = Some subshell_dir } )
8288 | _ -> Uri. parse_targets_tr original_args, default_target)
8389 in
84- { installables; target_info }
90+ { installables; target_info; printcmd }
8591 in
86- Term. (const build $ uris)
92+ Term. (const build $ uris $ printcmd )
8793 ;;
8894
8995 let cmd entrypoint =
@@ -104,6 +110,8 @@ module Cli = struct
104110 ; `P
105111 " If a single SOURCE is provided and it is a directory, ns switches into it by \
106112 default unless a TARGET_DIR is explicitly given."
113+ ; `S Manpage. s_options
114+ ; `S " "
107115 ; `S Manpage. s_common_options
108116 ; `S " "
109117 ; `S Manpage. s_examples
0 commit comments