SQLite-backed Key / Value Store
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: changed add args

now uses a basic struct instead of creating a chunky one.
will do the rest later

+6 -17
+3 -13
src/cli.rs
··· 16 16 #[derive(Subcommand, Debug)] 17 17 pub enum Commands { 18 18 /// Add a value to the store with the given key 19 - Add(AddArgs), 19 + Add { key: String, value: String }, 20 20 21 21 /// Get values from the store 22 22 Get(GetArgs), ··· 24 24 /// Remove values from the store 25 25 Rm(RemoveArgs), 26 26 27 - /// Output the alias command for key / value pairs 27 + /// Output the alias command for key / value pairs 28 28 Alias(SetArgs), 29 29 30 - /// Output the export command for a key / value pairs 30 + /// Output the export command for a key / value pairs 31 31 Export(SetArgs), 32 32 33 33 /// List all values in the store ··· 38 38 39 39 /// Purges the .safirstore directory, removing it and its contents 40 40 Purge, 41 - } 42 - 43 - /// Arguments for adding a value to the store with a given key 44 - #[derive(Args, Debug)] 45 - pub struct AddArgs { 46 - /// Name of the item to store 47 - pub key: String, 48 - 49 - /// Value to store 50 - pub value: String, 51 41 } 52 42 53 43 /// Arguments for retrieving values from the store with the given keys
+3 -4
src/main.rs
··· 1 1 mod cli; 2 - mod utils; 3 2 mod store; 3 + mod utils; 4 4 5 5 use cli::*; 6 6 use store::Store; 7 7 8 8 use anyhow::Result; 9 9 10 - 11 10 fn main() -> Result<()> { 12 11 let cli = Cli::parse(); 13 12 let mut safir = Store::init_safir(); 14 13 15 14 match &cli.command { 16 - Commands::Add(args) => { 17 - safir.add(args.key.to_owned(), args.value.to_owned()); 15 + Commands::Add { key, value } => { 16 + safir.add(key.to_owned(), value.to_owned()); 18 17 } 19 18 Commands::Get(args) => { 20 19 safir.get(args.keys.to_owned());