From 578ab46f3773ecb6a7ba39b9db9710914482713a Mon Sep 17 00:00:00 2001 From: Graham Keenan Date: Fri, 12 Jul 2024 14:50:46 +0100 Subject: [PATCH 1/2] feat(cli): added command to display loaded env --- src/cli.rs | 3 +++ src/main.rs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index 22dde6d..f2aa52f 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -70,4 +70,7 @@ pub enum Commands { #[arg(default_value_t = String::from("default"))] environment: String, }, + + /// Display the current loaded environment + Env, } diff --git a/src/main.rs b/src/main.rs index 7ed51d7..b0bc9cf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,6 +47,11 @@ async fn main() -> Result<()> { cfg.write().context("writing config out")?; println!("Using environment '{}'", environment); } + Commands::Env => { + let cfg = safir.get_config(); + let env = cfg.environment; + println!("Currently loaded environment: '{env}'"); + } } Ok(()) From 687e9537c80c8abd21e5242454cee3b38ec09c26 Mon Sep 17 00:00:00 2001 From: Graham Keenan Date: Fri, 12 Jul 2024 14:53:37 +0100 Subject: [PATCH 2/2] docs: updated docs --- CHANGELOG.md | 4 ++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 7 +++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 110536d..216642d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Documenting changes between versions beginning from v0.3.0 +## v0.10.1 + +* Added new command to display the currently loaded environment + ## v0.10.0 * SQLite DB support diff --git a/Cargo.lock b/Cargo.lock index e3bd091..d0d41e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1054,7 +1054,7 @@ checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "safir" -version = "0.10.0" +version = "0.10.1" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 7b75af2..13417b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "safir" -version = "0.10.0" +version = "0.10.1" edition = "2021" authors = ["Graham Keenan "] license = "MIT OR Apache-2.0" diff --git a/README.md b/README.md index 4c96e00..3944a40 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Commands: clear Clear all keys/values from the store purge Purges the .safirstore directory, removing it and its contents use Use / create an environment to store key / value pairs + env Display the current loaded environment help Print this message or the help of the given subcommand(s) Options: @@ -137,3 +138,9 @@ safir mode file # Switch to using a JSON file for storage safir mode database # Switch to using an SQLite database for storage ``` + +Displaying the currently loaded environment: + +```bash +safir env # Will display the currently loaded environment +```