reactive_graph_server/server/args/
mod.rs

1pub mod config_locations;
2pub mod logging;
3pub mod runtime;
4
5use crate::server::args::runtime::RuntimeArguments;
6use crate::server::commands::ServerCommands;
7use crate::shared::args::SharedArguments;
8use clap::Parser;
9
10#[derive(Parser, Debug)]
11pub struct ServerArguments {
12    #[command(subcommand)]
13    pub commands: Option<ServerCommands>,
14
15    #[clap(flatten)]
16    pub runtime: RuntimeArguments,
17
18    /// If true, logging is disabled completely.
19    #[arg(short = 'q', long, env = "REACTIVE_GRAPH_QUIET")]
20    pub quiet: Option<bool>,
21}
22
23#[derive(Parser, Debug)]
24#[command(name = "reactive-graph-server", author, version, about, long_about = None)]
25#[command(propagate_version = true)]
26pub struct ServerAndSharedArguments {
27    #[clap(flatten)]
28    pub shared: SharedArguments,
29
30    // #[cfg(feature = "server")]
31    #[clap(flatten)]
32    pub server: ServerArguments,
33}
34
35// Tests cannot be build if there are errors in the clap configuration (for
36// example, multiple arguments with the same name).
37#[cfg(test)]
38mod tests {
39    use super::*;
40    use crate::shared::completions::print_shell_completions;
41    use clap::CommandFactory;
42    use clap_complete::Shell;
43
44    #[test]
45    fn test_print_completions() {
46        let mut cmd = ServerAndSharedArguments::command();
47        print_shell_completions(Shell::Zsh, &mut cmd);
48    }
49
50    #[test]
51    fn test_print_markdown_help() {
52        clap_markdown::print_help_markdown::<ServerAndSharedArguments>();
53    }
54}