partiql_cli/
args.rs

1use clap::{ArgEnum, Parser, Subcommand};
2
3#[derive(Parser)]
4#[clap(author, version, about, long_about = None)]
5pub struct Args {
6    #[clap(subcommand)]
7    pub command: Commands,
8}
9
10#[derive(Subcommand)]
11pub enum Commands {
12    #[cfg(feature = "visualize")]
13    /// Dump the AST for a query
14    Ast {
15        #[clap(short = 'T', long = "format", value_enum)]
16        format: Format,
17
18        /// Query to parse
19        #[clap(value_parser)]
20        query: String,
21    },
22    /// interactive REPL (Read Eval Print Loop) shell
23    Repl,
24}
25
26#[derive(ArgEnum, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
27pub enum Format {
28    /// JSON
29    Json,
30    /// Graphviz dot
31    Dot,
32    /// Graphviz svg output
33    Svg,
34    /// Graphviz svg rendered to png
35    Png,
36    /// Display rendered output
37    Display,
38}