From 83f2d03cbb695decddf55f9ccc2873898680d356 Mon Sep 17 00:00:00 2001 From: John Freeman Date: Sun, 1 Dec 2024 20:20:43 -0500 Subject: [PATCH] new commands and options --- src/cli.rs | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++- src/main.rs | 1 + 2 files changed, 124 insertions(+), 2 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 0cdfb23..6c734ad 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,10 +1,131 @@ -use clap::Command; +use clap::{Arg, Command}; pub fn get_cli_matches() -> clap::ArgMatches { Command::new("glint") .version("0.1.0") .author("John Freeman") - .about("Send HTTP requests based on a request chain defined in TOML") + .about("A local-only, git-friendly scratchpad for testing API endpoints in your terminal.") .allow_external_subcommands(true) + .subcommand( + Command::new("vault") + .about("Manage encrypted configuration files securely") + .subcommand( + Command::new("create") + .about("Create a new, empty encrypted vault file") + .arg( + Arg::new("output") + .short('o') + .long("output") + .takes_value(true) + .help("Specify the name of the encrypted file"), + ), + ) + .subcommand( + Command::new("encrypt") + .about("Encrypt an existing plain-text file into a vault") + .arg( + Arg::new("file") + .required(true) + .help("The plain-text file to encrypt"), + ) + .arg( + Arg::new("delete") + .long("delete") + .takes_value(false) + .help("Delete the original plain-text file after encryption"), + ) + .arg( + Arg::new("output") + .short('o') + .long("output") + .takes_value(true) + .help("Specify the name of the encrypted output file"), + ), + ) + .subcommand( + Command::new("decrypt") + .about("Decrypt an encrypted vault file for viewing or editing") + .arg( + Arg::new("file") + .required(true) + .help("The encrypted vault file to decrypt"), + ) + .arg( + Arg::new("output") + .short('o') + .long("output") + .takes_value(true) + .help("Specify the name of the decrypted output file"), + ) + .arg( + Arg::new("temp") + .long("temp") + .takes_value(false) + .help("Decrypt to a temporary location without saving"), + ), + ) + .subcommand( + Command::new("edit") + .about("Securely edit an encrypted vault file in your preferred editor") + .arg( + Arg::new("file") + .required(true) + .help("The encrypted vault file to edit"), + ) + .arg( + Arg::new("editor") + .short('e') + .long("editor") + .takes_value(true) + .help("Specify the editor to use (e.g., vim, nano)"), + ) + .arg( + Arg::new("backup").long("backup").takes_value(false).help( + "Create a backup of the original encrypted file before editing", + ), + ), + ) + .subcommand( + Command::new("rotate") + .about("Change the password for an encrypted vault file") + .arg( + Arg::new("file") + .required(true) + .help("The encrypted vault file to update"), + ) + .arg( + Arg::new("old-password") + .long("old-password") + .takes_value(true) + .help("The current password for the file"), + ) + .arg( + Arg::new("new-password") + .long("new-password") + .takes_value(true) + .help("The new password for the file"), + ), + ) + .subcommand( + Command::new("list") + .about("List all encrypted (.encrypted) files in the current directory") + .arg( + Arg::new("path") + .short('p') + .long("path") + .takes_value(true) + .help("Specify the directory to scan for encrypted files"), + ), + ) + .subcommand( + Command::new("view") + .about("Securely view the decrypted contents of an encrypted vault file") + .arg( + Arg::new("file") + .required(true) + .help("The encrypted vault file to view"), + ), + ), + ) .get_matches() } diff --git a/src/main.rs b/src/main.rs index cb4ee80..f273c65 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +mod cli; mod executor; mod logging; mod options;