reactive_graph/client/args/
mod.rs

1pub mod connection;
2
3use clap::Parser;
4
5use crate::client::args::connection::ClientConnectionArguments;
6use crate::client::commands::ClientCommands;
7use crate::shared::args::SharedArguments;
8
9#[derive(Parser, Debug, Clone)]
10pub struct ClientArguments {
11    #[clap(flatten)]
12    pub(crate) connection: ClientConnectionArguments,
13
14    #[command(subcommand)]
15    pub(crate) commands: Option<ClientCommands>,
16}
17
18#[derive(Parser, Debug)]
19#[command(name = "reactive-graph-client", author, version, about, long_about = None)]
20#[command(propagate_version = true)]
21pub struct ClientAndSharedArguments {
22    #[clap(flatten)]
23    pub shared: SharedArguments,
24
25    #[clap(flatten)]
26    pub client: ClientArguments,
27}
28
29// Tests cannot be build if there are errors in the clap configuration (for
30// example, multiple arguments with the same name).
31#[cfg(test)]
32mod tests {
33    use super::*;
34    use crate::shared::completions::print_shell_completions;
35    use clap::CommandFactory;
36    use clap_complete::Shell;
37
38    #[test]
39    fn test_print_completions() {
40        let mut cmd = ClientAndSharedArguments::command();
41        print_shell_completions(Shell::Zsh, &mut cmd);
42    }
43
44    #[test]
45    fn test_print_markdown_help() {
46        clap_markdown::print_help_markdown::<ClientAndSharedArguments>();
47    }
48}