1 //! Helpers for building the command-line arguments for commands.
3 pub use clap
::{arg, Arg, ArgMatches, Command}
;
4 use std
::path
::PathBuf
;
6 pub trait CommandExt
: Sized
{
7 fn _arg(self, arg
: Arg
) -> Self;
9 fn arg_dest_dir(self) -> Self {
14 .value_name("dest-dir")
15 .value_parser(clap
::value_parser
!(PathBuf
))
17 "Output directory for the book\n\
18 Relative paths are interpreted relative to the book's root directory.\n\
19 If omitted, mdBook uses build.build-dir from book.toml \
20 or defaults to `./book`.",
25 fn arg_root_dir(self) -> Self {
29 "Root directory for the book\n\
30 (Defaults to the current directory when omitted)",
32 .value_parser(clap
::value_parser
!(PathBuf
)),
36 fn arg_open(self) -> Self {
37 self._arg(arg
!(-o
--open
"Opens the compiled book in a web browser"))
41 impl CommandExt
for Command
{
42 fn _arg(self, arg
: Arg
) -> Self {