yuna

Naive terminal variables manager.

Introduction

%s %s

Naive terminal variables manager.

https://sw.cowtech.it/yuna

Features

Installation

Prebuilt Binaries

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 yuna

From Source (Cargo)

If your platform is not available or you prefer to build from source, ensure you have Rust installed, then run:

cargo install yuna

Usage

Basic Commands

# 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 -V

Configuration Files

Yuna stores variables in YAML files (.yuna.yml by default). The tool automatically:

Nested Variables

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.host

Variable Interpolation

Variables 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_endpoint

Command-Line Options

Options: 
  -c, --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:

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:

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:

Variable Priority

When the same variable is defined in multiple configuration files:

  1. Files are loaded from root to current directory
  2. Later values override earlier ones
  3. Nested objects are merged recursively
  4. Arrays are concatenated when merging

Contributing to yuna

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.