Crates.io | repvar |
lib.rs | repvar |
version | |
source | src |
created_at | 2021-08-03 15:36:11.821826 |
updated_at | 2024-12-09 06:35:51.778341 |
description | A tiny CLI tool that replaces variables of the style `${KEY}` in text with their respective value. It can also be used as a rust library. |
homepage | https://github.com/hoijui/repvar |
repository | https://github.com/hoijui/repvar |
max_upload_size | |
id | 430982 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
repvar
- Variable replacing, UNIX-style text filterA tiny CLI tool that replaces variables of the style ${KEY}
in text with their respective value.
It can also be used as a rust library.
For the CLI tool,
the variables can be read from the environment
or be directly supplied through CLI switches,
like -Dkey=value
.
NOTE
The author is a rust-newb. This crate probably only makes sense for himself, and it is not using the power of rust as should be. It also could probably be written in just 10 lines of code, using one or two regexes, not loosing any performance.
$ export KEY_A="replacement" # setting an env.-variable
$ echo 'Text ${KEY_A}.' \ # input text
| repvar --env # replacing variables
Text replacement. # output
$ export first="the environment"
$ echo 'Variables from ${first}, ${second}, ${not_supplied} and $${quoted}.' \
| repvars --env -D"second=the CLI"
Variables from the environment, the CLI, ${not_supplied} and ${quoted}.
More usage info can be seen when running:
repvars --help
# To get a binary for your system
cargo build --release
# To get a 64bit binary that is portabel to all Linux systems
scripts/build
To run unit-, doc- and integration-tests:
scripts/test
This project was funded by the European Regional Development Fund (ERDF) in the context of the INTERFACER Project, from August 2021 (project start) until March 2023.