Skip to content

Commit d114439

Browse files
committed
feat: add ability to configure envfetch (closes #21)
1 parent bd378f4 commit d114439

8 files changed

+321
-35
lines changed

Cargo.lock

+151-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ env_logger = "0.11.6"
3030
# Interactive mode with TUI
3131
ratatui = "0.29.0"
3232
crossterm = "0.28.1"
33+
# Config parsing
34+
serde = { version = "1.0.219", features = ["derive"] }
35+
toml = "0.8.20"
36+
# Finding directories
37+
dirs = "6.0.0"
3338

3439
[dev-dependencies]
3540
# Asserting CLI programs

README.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ To run envfetch, run `envfetch <COMMAND> <ARGS>` in your terminal.
8080
You can run `envfetch help` to see help message or `envfetch --version` to see program's version.
8181

8282
### Command list
83-
### Interactive
83+
#### Interactive
8484
> [!NOTE]
8585
> Interactive mode is currently WIP and only list variables is available.
8686
> See for progress in https://github.com/ankddev/envfetch/issues/17. Also it isn't in latest released ersion `v1.4.0`, if you want to test it,
@@ -92,6 +92,17 @@ Usage:
9292
`envfetch interactive`
9393

9494
This will start TUI, where you will be able to work with environment variables.
95+
#### Init config
96+
Initialize config file for `envfetch`.
97+
98+
Usage:
99+
`envfetch init-config`
100+
101+
Options:
102+
- `--help`/`-h` - showw help message.
103+
104+
> [!WARNING]
105+
> Currently this command will overwrite any existing config file!
95106
#### Set
96107
Set environment variable and optionally run process.
97108

@@ -223,6 +234,15 @@ $ envfetch load --global --file .env.prod # permanent from specific file
223234
> - On Unix-like systems, variables are stored in shell configuration files (.bashrc, .zshrc, or config.fish)
224235
>
225236
> Without `--global` flag, variables are only set for the current process run
237+
## Configuration
238+
`envfetch` support some configuration. Fitsly, you need to run `envfetch init-config` to create config file, it will return you path of config.
239+
| Platform | Path |
240+
| -------- | ------------------------------------------------- |
241+
| Windows | `C:\Users\<USER>\AppData\Roaming\envfetch.toml` |
242+
| Linux | `$HOME/.config/envfetch.toml` |
243+
| macOS | `$HOME/Library/Application Support/envfetch.toml` |
244+
### Keys
245+
- `print_format` - Format string for print command
226246
# Building from source
227247
- Install Rust. If it already installed, update with
228248
```shell

assets/default_config.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Config for envfetch. See for documentation in our documentation.
2+
# https://github.com/ankddev/envfetch
3+
4+
# Custom format for list of variables. {name} is replaced with variable's name and {value} is replaced with it's value
5+
# print_format = "{name} = {value}"

0 commit comments

Comments
 (0)