settingspec 0.7.0__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {settingspec-0.7.0 → settingspec-0.8.0}/Cargo.lock +1 -1
- {settingspec-0.7.0 → settingspec-0.8.0}/Cargo.toml +1 -1
- {settingspec-0.7.0 → settingspec-0.8.0}/PKG-INFO +27 -4
- {settingspec-0.7.0 → settingspec-0.8.0}/README.md +26 -3
- {settingspec-0.7.0 → settingspec-0.8.0}/src/cli.rs +28 -6
- {settingspec-0.7.0 → settingspec-0.8.0}/LICENSE-APACHE +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/LICENSE-MIT +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/pyproject.toml +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/envfile.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/error.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/filter.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/c.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/common.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/cpp.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/elm.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/env.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/go.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/haskell.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/java.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/javascript.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/json.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/lua.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/mod.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/python.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/ruby.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/rust.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/scala.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/terraform.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/toml.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/tree.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/typescript.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/yaml.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/generator/zig.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/lib.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/main.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/model.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/parser.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/profile.rs +0 -0
- {settingspec-0.7.0 → settingspec-0.8.0}/src/resolver.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: settingspec
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -30,7 +30,8 @@ Project-URL: Source Code, https://github.com/sayanarijit/settingspec
|
|
|
30
30
|
|
|
31
31
|
# SettingSpec
|
|
32
32
|
|
|
33
|
-
1. [
|
|
33
|
+
1. [Install](#install)
|
|
34
|
+
2. [Concepts](#concepts)
|
|
34
35
|
1. [Single file convenience](#single-file-convenience)
|
|
35
36
|
2. [Declarative profiles as environments](#declarative-profiles-as-environments)
|
|
36
37
|
3. [Language independent](#language-independent)
|
|
@@ -38,7 +39,29 @@ Project-URL: Source Code, https://github.com/sayanarijit/settingspec
|
|
|
38
39
|
1. [SecretSpec](#secretspec)
|
|
39
40
|
2. [Dotenv](#dotenv)
|
|
40
41
|
3. [Cottage or agebox](#cottage-or-agebox)
|
|
41
|
-
|
|
42
|
+
3. [Learn more](#learn-more)
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# rust: cargo-binstall/cargo
|
|
48
|
+
cargo binstall --locked settingspec
|
|
49
|
+
cargo install --locked settingspec
|
|
50
|
+
|
|
51
|
+
# python: pip/uv/uvx
|
|
52
|
+
pip install settingspec
|
|
53
|
+
uv pip install settingspec
|
|
54
|
+
uvx settingspec --version
|
|
55
|
+
|
|
56
|
+
# node: yarn/pnpm/npx
|
|
57
|
+
yarn global add @sayanarijit/settingspec
|
|
58
|
+
pnpm add -g @sayanarijit/settingspec
|
|
59
|
+
npx @sayanarijit/settingspec --version
|
|
60
|
+
|
|
61
|
+
# container: docker/podman
|
|
62
|
+
docker run --rm -v $PWD:/app ghcr.io/sayanarijit/settingspec --version
|
|
63
|
+
podman run --rm -v $PWD:/app ghcr.io/sayanarijit/settingspec --version
|
|
64
|
+
```
|
|
42
65
|
|
|
43
66
|
## Concepts
|
|
44
67
|
|
|
@@ -71,7 +94,7 @@ key2._ = { # Strictly define different values for different profiles
|
|
|
71
94
|
|
|
72
95
|
Overrides are intentional and kept in plain sight (see `key1`).
|
|
73
96
|
|
|
74
|
-
By not defining a default value, you can ensure that you never miss adding a value for a specific profile (e.g. this file will refuse to load if `key2.prod` declaration is missing).
|
|
97
|
+
By not defining a default value, you can ensure that you never miss adding a value for a specific profile (e.g. this file will refuse to load if `key2._.prod` declaration is missing).
|
|
75
98
|
|
|
76
99
|
### Language independent
|
|
77
100
|
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
# SettingSpec
|
|
15
15
|
|
|
16
|
-
1. [
|
|
16
|
+
1. [Install](#install)
|
|
17
|
+
2. [Concepts](#concepts)
|
|
17
18
|
1. [Single file convenience](#single-file-convenience)
|
|
18
19
|
2. [Declarative profiles as environments](#declarative-profiles-as-environments)
|
|
19
20
|
3. [Language independent](#language-independent)
|
|
@@ -21,7 +22,29 @@
|
|
|
21
22
|
1. [SecretSpec](#secretspec)
|
|
22
23
|
2. [Dotenv](#dotenv)
|
|
23
24
|
3. [Cottage or agebox](#cottage-or-agebox)
|
|
24
|
-
|
|
25
|
+
3. [Learn more](#learn-more)
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# rust: cargo-binstall/cargo
|
|
31
|
+
cargo binstall --locked settingspec
|
|
32
|
+
cargo install --locked settingspec
|
|
33
|
+
|
|
34
|
+
# python: pip/uv/uvx
|
|
35
|
+
pip install settingspec
|
|
36
|
+
uv pip install settingspec
|
|
37
|
+
uvx settingspec --version
|
|
38
|
+
|
|
39
|
+
# node: yarn/pnpm/npx
|
|
40
|
+
yarn global add @sayanarijit/settingspec
|
|
41
|
+
pnpm add -g @sayanarijit/settingspec
|
|
42
|
+
npx @sayanarijit/settingspec --version
|
|
43
|
+
|
|
44
|
+
# container: docker/podman
|
|
45
|
+
docker run --rm -v $PWD:/app ghcr.io/sayanarijit/settingspec --version
|
|
46
|
+
podman run --rm -v $PWD:/app ghcr.io/sayanarijit/settingspec --version
|
|
47
|
+
```
|
|
25
48
|
|
|
26
49
|
## Concepts
|
|
27
50
|
|
|
@@ -54,7 +77,7 @@ key2._ = { # Strictly define different values for different profiles
|
|
|
54
77
|
|
|
55
78
|
Overrides are intentional and kept in plain sight (see `key1`).
|
|
56
79
|
|
|
57
|
-
By not defining a default value, you can ensure that you never miss adding a value for a specific profile (e.g. this file will refuse to load if `key2.prod` declaration is missing).
|
|
80
|
+
By not defining a default value, you can ensure that you never miss adding a value for a specific profile (e.g. this file will refuse to load if `key2._.prod` declaration is missing).
|
|
58
81
|
|
|
59
82
|
### Language independent
|
|
60
83
|
|
|
@@ -6,7 +6,8 @@ use crate::model::*;
|
|
|
6
6
|
use crate::parser::parse_config_str;
|
|
7
7
|
use crate::profile::resolve_active_profile;
|
|
8
8
|
use crate::resolver::resolve_settings;
|
|
9
|
-
use clap::
|
|
9
|
+
use clap::builder::styling::*;
|
|
10
|
+
use clap::{CommandFactory, Parser, Subcommand};
|
|
10
11
|
use std::collections::{HashMap, HashSet};
|
|
11
12
|
use std::io::Write;
|
|
12
13
|
use std::path::{Path, PathBuf};
|
|
@@ -31,12 +32,14 @@ impl Drop for CleanupGuard {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
const STYLES: Styles = Styles::styled()
|
|
36
|
+
.header(AnsiColor::Green.on_default().bold())
|
|
37
|
+
.usage(AnsiColor::Green.on_default().bold())
|
|
38
|
+
.literal(AnsiColor::Cyan.on_default().bold())
|
|
39
|
+
.placeholder(AnsiColor::Cyan.on_default().dimmed());
|
|
40
|
+
|
|
34
41
|
#[derive(Parser, Debug)]
|
|
35
|
-
#[command(
|
|
36
|
-
name = "settingspec",
|
|
37
|
-
version,
|
|
38
|
-
about = "One file for all environments, all languages, all submodules."
|
|
39
|
-
)]
|
|
42
|
+
#[command(author, version, about, styles = STYLES, long_about = None, arg_required_else_help = true)]
|
|
40
43
|
pub struct Cli {
|
|
41
44
|
#[command(subcommand)]
|
|
42
45
|
pub command: Commands,
|
|
@@ -60,6 +63,16 @@ pub enum Commands {
|
|
|
60
63
|
|
|
61
64
|
/// Deletes all generated export files
|
|
62
65
|
Clean,
|
|
66
|
+
|
|
67
|
+
#[cfg(feature = "autocomplete")]
|
|
68
|
+
/// Generate shell completions.
|
|
69
|
+
/// Example: `eval "$(settingspec autocomplete bash)"` to load completions for bash.
|
|
70
|
+
#[command(name = "autocomplete")]
|
|
71
|
+
AutoComplete {
|
|
72
|
+
/// The shell to generate completions for.
|
|
73
|
+
#[arg(value_enum)]
|
|
74
|
+
shell: clap_complete::Shell,
|
|
75
|
+
},
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
pub const INIT_CONFIG: &str = r#"[spec]
|
|
@@ -173,9 +186,18 @@ pub fn run_cli() -> Result<()> {
|
|
|
173
186
|
}
|
|
174
187
|
Commands::Watch => run_watch(),
|
|
175
188
|
Commands::Clean => clean_exported_files(),
|
|
189
|
+
Commands::AutoComplete { shell } => generate_autocompletions(shell),
|
|
176
190
|
}
|
|
177
191
|
}
|
|
178
192
|
|
|
193
|
+
fn generate_autocompletions(shell: clap_complete::Shell) -> Result<()> {
|
|
194
|
+
let mut cmd = Cli::command();
|
|
195
|
+
let mut out = std::io::stdout();
|
|
196
|
+
let bin_name = cmd.get_name().to_string();
|
|
197
|
+
clap_complete::generate(shell, &mut cmd, bin_name, &mut out);
|
|
198
|
+
Ok(())
|
|
199
|
+
}
|
|
200
|
+
|
|
179
201
|
fn run_watch() -> Result<()> {
|
|
180
202
|
let ctx = load_and_resolve()?;
|
|
181
203
|
let config_path = ctx.project_root.join("settingspec.toml");
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|