| 5 | use clap::{Arg, ArgMatches}; |
| 6 | |
| 7 | pub fn cli() -> clap::Command { |
| 8 | clap::Command::new("unlock") |
| 9 | .about("Unlock a database to allow deletion") |
| 10 | .long_about( |
| 11 | "Unlock a database that was previously locked with `spacetime lock`.\n\n\ |
| 12 | After unlocking, the database can be deleted normally with `spacetime delete`.", |
| 13 | ) |
| 14 | .arg( |
| 15 | Arg::new("database") |
| 16 | .required(false) |
| 17 | .help("The name or identity of the database to unlock"), |
| 18 | ) |
| 19 | .arg(common_args::server().help("The nickname, host name or URL of the server hosting the database")) |
| 20 | .arg( |
| 21 | Arg::new("no_config") |
| 22 | .long("no-config") |
| 23 | .action(clap::ArgAction::SetTrue) |
| 24 | .help("Ignore spacetime.json configuration"), |
| 25 | ) |
| 26 | .after_help("Run `spacetime help unlock` for more detailed information.\n") |
| 27 | } |
| 28 | |
| 29 | pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::Error> { |
| 30 | let server_from_cli = args.get_one::<String>("server").map(|s| s.as_ref()); |