Naive terminal variables manager.
- Store and retrieve variables in YAML format
- Hierarchical configuration with automatic parent directory merging
- Variable interpolation with
{variable}or{{variable}}syntax - Support for nested objects and arrays
- Clean table output with source tracking
- Simple command-line interface
Download one of the prebuilt binaries for your platform, then make it executable:
Example:
curl -L -o yuna https://github.com/ShogunPanda/yuna/releases/latest/download/yuna-linux
chmod a+x yunaIf your platform is not available or you prefer to build from source, ensure you have Rust installed, then run:
cargo install yuna# List all variables in the current directory and parent directories
yuna
# Set a variable
yuna my_var "some value"
# Set a variable with multiple words (they will be joined with spaces)
yuna greeting Hello World from Yuna
# Get a variable value
yuna my_var
# Delete a variable
yuna -d my_var
# or
yuna --delete my_var
# Show version
yuna -VYuna stores variables in YAML files (.yuna.yml by default). The tool automatically:
- Creates a
.yuna.ymlfile in the current directory when you save a variable - Searches for and merges
.yuna.ymlfiles from all parent directories up to the root - Shows which file each variable comes from in the listing
You can work with nested structures using dot notation:
# Set nested object values
yuna database.host localhost
yuna database.port 5432
yuna database.name myapp
# Set array values
yuna servers.0 "server1.example.com"
yuna servers.1 "server2.example.com"
# Read nested values
yuna database.hostVariables can reference other variables using {var} or {{var}} syntax:
# Set base variables
yuna base_url "https://api.example.com"
yuna api_version "v1"
# Use interpolation
yuna api_endpoint "{base_url}/{api_version}"
# When reading api_endpoint, it will show: https://api.example.com/v1
yuna api_endpointOptions:
-c, --config <CONFIG> Configuration file name [default: .yuna.yml]
-d, --delete Delete a variable
-n, --no-merge Do not merge with configuration files in parent folders
-r, --raw Do not perform variable interpolation
-V, --version Print version
-h, --help Print help
When listing variables, Yuna displays a formatted table showing:
- Name: Variable name (cyan)
- Value: Raw value as stored (green)
- Raw: Value with interpolation applied (or raw if -r flag is used)
- Source: File where the variable is defined (grey)
When you run Yuna, it searches for configuration files starting from the root directory down to your current directory, loading each .yuna.yml file it finds. Values from files closer to your current directory override those from parent directories. This allows for:
- Global settings at the root level
- Project-specific overrides in project directories
- Local development overrides in subdirectories
Example directory structure:
/
├── .yuna.yml # Global variables
├── projects/
│ ├── .yuna.yml # Project-wide variables
│ └── my-app/
│ ├── .yuna.yml # App-specific variables
│ └── src/
│ └── .yuna.yml # Source-specific variables
Yuna supports all YAML data types:
- Strings: Simple text values
- Numbers: Integer and floating-point values
- Booleans: true/false values
- Arrays: Ordered lists accessible via numeric indices
- Objects: Nested key-value pairs accessible via dot notation
- Null: Empty values
When the same variable is defined in multiple configuration files:
- Files are loaded from root to current directory
- Later values override earlier ones
- Nested objects are merged recursively
- Arrays are concatenated when merging
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
- Fork the project
- Start a feature/bugfix branch
- Commit and push until you are happy with your contribution
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
Copyright (C) 2021 and above Shogun (shogun@cowtech.it).
Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
