reactive_graph_tooling/tooling/
args.rs

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