yuna
Naive terminal variables manager.
Features
- 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
Installation
Prebuilt Binaries
Download one of the prebuilt binaries for your platform, then make it executable:
Example:
From Source (Cargo)
If your platform is not available or you prefer to build from source, ensure you have Rust installed, then run:
Usage
Basic Commands
# List all variables in the current directory and parent directories
# Set a variable
# Set a variable with multiple words (they will be joined with spaces)
# Get a variable value
# Delete a variable
# or
# Show version
Configuration Files
Yuna 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
Nested Variables
You can work with nested structures using dot notation:
# Set nested object values
# Set array values
# Read nested values
Variable Interpolation
Variables can reference other variables using {var} or {{var}} syntax:
# Set base variables
# Use interpolation
# When reading api_endpoint, it will show: https://api.example.com/v1
Command-Line Options
Options:
-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
Output Format
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)
How It Works
File Hierarchy and Merging
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
Data Types
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
Variable Priority
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
Contributing to yuna
- 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
Copyright (C) 2021 and above Shogun (shogun@cowtech.it).
Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.