···8989 println!("{}", "--=Safirstore=--\n".bold());
9090}
91919292+pub fn print_headless(prefix: &str, key: &str, value: &str) {
9393+ if value == "" {
9494+ return;
9595+ }
9696+9797+ let has_whitespace = value.contains(char::is_whitespace);
9898+9999+ let output = if has_whitespace {
100100+ format!("{}=\"{}\"", key, value)
101101+ } else {
102102+ format!("{}={}", key, value)
103103+ };
104104+105105+ if !prefix.is_empty() {
106106+ println!("{} {}", prefix, output);
107107+ } else {
108108+ println!("{}", output);
109109+ }
110110+}
111111+92112/// Confirmation dialog for important calls
93113pub fn confirm_entry(msg: &str) -> bool {
94114 let mut answer = String::new();
+8
safir-mem/CHANGELOG.md
···2233Documenting changes between versions
4455+## v0.3.0
66+77+Removed formatted output
88+99+This makes more sense in the for safir-mem as it means you can easily evaluate output in the terminal
1010+1111+Better suits the use case.
1212+513## v0.2.1
614715Changes to the internal code structure, no changes to operation
+2-2
safir-mem/Cargo.toml
···11[package]
22name = "safir-mem"
33-version = "0.2.1"
33+version = "0.3.0"
44edition = "2021"
55authors = ["Graham Keenan graham.keenan@outlook.com"]
66license = "MIT OR Apache-2.0"
···1616[dependencies]
1717clap = { version = "4.2.5" , features = ["derive"] }
1818tokio = { version = "1.28.2", features = ["full"] }
1919-safir-core = { version = "0.2.0", path = "../safir-core" }
1919+safir-core = { version = "0.2.1", path = "../safir-core" }
2020anyhow = "1.0.75"
+1-2
safir-mem/src/main.rs
···2121 if let Some(key) = &args.key {
2222 safir_mem.get_entry(key.to_string()).await?;
2323 } else {
2424- utils::print_header();
2525- utils::print_output("A key is required for memcache GET command!");
2424+ println!("A key is required for memcache GET command!");
2625 }
2726 }
2827 Commands::Rm(args) => {
+10
safir/CHANGELOG.md
···2233Documenting changes between versions beginning from v0.3.0
4455+## v0.8.0
66+77+Headless mode!
88+99+You can now run safir in "headless" mode which removes all the fancy formatting for output
1010+1111+This will allow you to evaluate safir output directly in the terminal.
1212+1313+This also persist as a config setting saved to `~/.safirstore/safir.cfg`
1414+515## v0.7.1
616717Changes to the internal code structure, no changes to operation
+2-2
safir/Cargo.toml
···11[package]
22name = "safir"
33-version = "0.7.1"
33+version = "0.8.0"
44edition = "2021"
55authors = ["Graham Keenan graham.keenan@outlook.com"]
66license = "MIT OR Apache-2.0"
···1616[dependencies]
1717clap = { version = "4.2.5" , features = ["derive"] }
1818tokio = { version = "1.28.2", features = ["full"] }
1919-safir-core = { version = "0.2.0", path = "../safir-core" }
1919+safir-core = { version = "0.2.1", path = "../safir-core" }
2020anyhow = "1.0.75"
+9-8
safir/README.md
···2828Usage: safir <COMMAND>
29293030Commands:
3131- add Add a value to the store with the given key
3232- get Get a value from the store
3333- rm Remove values from the store
3434- alias Output the alias command for a key / value pair to be entered into a shell session
3535- export Output the export command for a key / value pair to be entered into a shell session
3636- clear Clear all keys/values from the store
3737- purge Purges the .safirstore directory, removing it and its contents
3838- help Print this message or the help of the given subcommand(s)
3131+ add Add a value to the store with the given key
3232+ get Get a value from the store
3333+ rm Remove values from the store
3434+ alias Output the alias command for a key / value pair to be entered into a shell session
3535+ export Output the export command for a key / value pair to be entered into a shell session
3636+ clear Clear all keys/values from the store
3737+ purge Purges the .safirstore directory, removing it and its contents
3838+ headless Set the headless mode
3939+ help Print this message or the help of the given subcommand(s)
39404041Options:
4142 -h, --help Print help
+13
safir/src/cli.rs
···35353636 /// Purges the .safirstore directory, removing it and its contents
3737 Purge,
3838+3939+ /// Set the headless mode
4040+ #[clap(subcommand)]
4141+ Headless(HeadlessFlags),
3842}
39434044/// Arguments for adding a value to the store with a given key
···7175 /// Name of the keys to display (e.g. alias / export)
7276 pub keys: Vec<String>,
7377}
7878+7979+#[derive(Subcommand, Debug)]
8080+pub enum HeadlessFlags {
8181+ /// Set headless mode ON
8282+ On,
8383+8484+ /// Set headless mode OFF
8585+ Off,
8686+}