| 17 | use spacetimedb_lib::sats::{satn, ProductType, ProductValue, Typespace}; |
| 18 | |
| 19 | pub fn cli() -> clap::Command { |
| 20 | clap::Command::new("sql") |
| 21 | .about(format!("Runs a SQL query on the database. {UNSTABLE_WARNING}")) |
| 22 | .arg( |
| 23 | Arg::new("sql_parts") |
| 24 | .num_args(0..) |
| 25 | .help("SQL arguments: [DATABASE] <QUERY>"), |
| 26 | ) |
| 27 | .arg( |
| 28 | Arg::new("interactive") |
| 29 | .long("interactive") |
| 30 | .action(ArgAction::SetTrue) |
| 31 | .help("Instead of using a query, run an interactive command prompt for `SQL` expressions"), |
| 32 | ) |
| 33 | .arg(common_args::confirmed()) |
| 34 | .arg(common_args::anonymous()) |
| 35 | .arg(common_args::server().help("The nickname, host name or URL of the server hosting the database")) |
| 36 | .arg(common_args::yes()) |
| 37 | .arg( |
| 38 | Arg::new("no_config") |
| 39 | .long("no-config") |
| 40 | .action(ArgAction::SetTrue) |
| 41 | .help("Ignore spacetime.json configuration"), |
| 42 | ) |
| 43 | } |
| 44 | |
| 45 | pub(crate) async fn parse_req( |
| 46 | mut config: Config, |