origen/commands/
web.rs

1use super::_prelude::*;
2
3pub const BASE_CMD: &'static str = "web";
4
5gen_core_cmd_funcs!(
6    BASE_CMD,
7    "Build and view application documentation",
8    { |cmd: App| { cmd.arg_required_else_help(true).visible_alias("w") } },
9    core_subcmd!("build", "Build the application documentation", {
10        |cmd: App| {
11            cmd.visible_alias("b")
12                .visible_alias("compile")
13                .visible_alias("html")
14                .arg(
15                    Arg::new("view")
16                        .long("view")
17                        .help("Open the generated documentation after a successful build")
18                        .action(SetArgTrue),
19                )
20                .arg(
21                    Arg::new("clean")
22                        .long("clean")
23                        .help("Clean generated documentation before building")
24                        .action(SetArgTrue),
25                )
26                .arg(
27                    Arg::new("no-api")
28                        .long("no-api")
29                        .help("Skip Python and Rust API documentation generation")
30                        .action(SetArgTrue),
31                )
32                .arg(
33                    Arg::new("release")
34                        .long("release")
35                        .short('r')
36                        .help("Release the generated documentation")
37                        .action(SetArgTrue),
38                )
39                .arg(
40                    Arg::new("archive")
41                        .long("archive")
42                        .short('a')
43                        .help("Archive the generated documentation under the given ID")
44                        .action(SetArg)
45                        .value_name("ARCHIVE_ID"),
46                )
47                .arg(
48                    Arg::new("as-release")
49                        .long("as-release")
50                        .help("Build with release checks without publishing")
51                        .action(SetArgTrue),
52                )
53                .arg(
54                    Arg::new("release-with-warnings")
55                        .long("release-with-warnings")
56                        .help("Allow a release build to complete with warnings")
57                        .requires("release")
58                        .action(SetArgTrue),
59                )
60                .arg(
61                    Arg::new("sphinx-args")
62                        .long("sphinx-args")
63                        .help("Additional arguments passed to sphinx-build")
64                        .action(SetArg)
65                        .allow_hyphen_values(true)
66                        .value_name("ARGS"),
67                )
68        }
69    }),
70    core_subcmd!("view", "Open previously generated documentation", {
71        |cmd: App| cmd.visible_alias("v")
72    }),
73    core_subcmd!(
74        "serve",
75        "Build, watch, and serve application documentation",
76        {
77            |cmd: App| {
78                cmd.visible_alias("s")
79                .arg(
80                    Arg::new("host")
81                        .long("host")
82                        .help("Host interface for the documentation server; auto binds all interfaces and advertises this machine's hostname")
83                        .action(SetArg)
84                        .default_value("auto")
85                        .value_name("HOST"),
86                )
87                .arg(
88                    Arg::new("port")
89                        .long("port")
90                        .short('p')
91                        .help("Port for the documentation server")
92                        .action(SetArg)
93                        .default_value("8000")
94                        .value_name("PORT"),
95                )
96                .arg(
97                    Arg::new("open")
98                        .long("open")
99                        .help("Open the documentation in the default browser")
100                        .action(SetArgTrue),
101                )
102                .arg(
103                    Arg::new("fast")
104                        .long("fast")
105                        .help("Skip AutoAPI, Rustdoc, and documentation subprojects")
106                        .action(SetArgTrue),
107                )
108                .arg(
109                    Arg::new("sphinx-args")
110                        .long("sphinx-args")
111                        .help("Additional arguments passed to sphinx-autobuild")
112                        .action(SetArg)
113                        .allow_hyphen_values(true)
114                        .value_name("ARGS"),
115                )
116            }
117        }
118    ),
119    core_subcmd!("clean", "Remove generated documentation", {
120        |cmd: App| cmd.visible_alias("c")
121    })
122);
123
124gen_simple_run_func!();