-
Notifications
You must be signed in to change notification settings - Fork 0
Command Reference
Complete reference for all rs-env commands and options.
These options work with all commands:
| Option | Description |
|---|---|
-d, --debug |
Enable debug logging (use multiple times for more verbosity) |
--generate <shell> |
Generate shell completion script (bash, zsh, fish, powershell) |
--info |
Display version and configuration information |
-h, --help |
Print help information |
-V, --version |
Print version information |
# Show version
rsenv --version
# Enable debug output
rsenv -d build production.env
# Very verbose debug
rsenv -ddd build production.env
# Generate bash completion
rsenv --generate bash > ~/.bash_completion.d/rsenv
# Show info
rsenv --infoBuild complete environment from hierarchy.
Syntax:
rsenv build <file>Arguments:
-
<file>- Environment file to build (required)
Output: Export statements ready for sourcing
Examples:
# Build environment
rsenv build production.env
# Load into shell
source <(rsenv build production.env)
# Save to file
rsenv build production.env > .envList all leaf environment files (files with no children).
Syntax:
rsenv leaves <directory>Arguments:
-
<directory>- Directory to search (required)
Output: List of leaf file paths
Examples:
# Find all leaves
rsenv leaves .
# Find leaves in subdirectory
rsenv leaves environments/
# Build all leaves
for env in $(rsenv leaves .); do
rsenv build "$env"
doneSee: Viewing Hierarchies
Display hierarchical structure of environment files.
Syntax:
rsenv tree <directory>Arguments:
-
<directory>- Directory to visualize (required)
Output: Tree structure showing parent-child relationships
Examples:
# View tree
rsenv tree .
# View specific directory
rsenv tree environments/
# Save tree to file
rsenv tree . > hierarchy.txtSee: Viewing Hierarchies
Show all environment chains as linear paths.
Syntax:
rsenv branches <directory>Arguments:
-
<directory>- Directory to search (required)
Output: Linear representation of all chains (root β leaf)
Examples:
# View all branches
rsenv branches .
# View branches in subdirectory
rsenv branches environments/See: Viewing Hierarchies
Interactive environment selection with fuzzy finder + direnv update.
Syntax:
rsenv select <directory>Arguments:
-
<directory>- Directory to search (required)
Behavior:
- Opens fuzzy finder with all
.envfiles - User selects file interactively
- Builds selected environment
- Updates
.envrc(if using direnv) - Reloads direnv
Examples:
# Select from current directory
rsenv select .
# Select from subdirectory
rsenv select environments/Requirements: Terminal with TTY support
Interactive selection and editing of environment files.
Syntax:
rsenv edit <directory>Arguments:
-
<directory>- Directory to search (required)
Behavior:
- Opens fuzzy finder with all
.envfiles - User selects file
- Opens file in
$EDITOR
Environment Variables:
-
EDITOR- Editor to use (default:vim)
Examples:
# Edit file in current directory
rsenv edit .
# Edit with specific editor
EDITOR=code rsenv edit .
# Edit in subdirectory
rsenv edit environments/Requirements: Terminal with TTY support, $EDITOR set
Edit entire hierarchy side-by-side.
Syntax:
rsenv tree-edit <directory>Arguments:
-
<directory>- Directory containing hierarchy (required)
Behavior:
- Discovers all
.envfiles in directory - Opens all files in
$EDITORsimultaneously - Files arranged hierarchically (parent β child)
Environment Variables:
-
EDITOR- Editor to use (default:vim)
Examples:
# Edit hierarchy
rsenv tree-edit .
# Edit with vim
EDITOR=vim rsenv tree-edit environments/
# Edit with VS Code
EDITOR=code rsenv tree-edit .Requirements: Terminal with TTY support, $EDITOR set
See: Tree Editing
Update .envrc file for direnv integration.
Syntax:
rsenv envrc <file> [output]Arguments:
-
<file>- Environment file to build (required) -
[output]- Output file path (default:./.envrc)
Behavior:
- Builds environment from file
- Writes export statements to output file
Examples:
# Generate .envrc
rsenv envrc production.env
# Generate to custom location
rsenv envrc production.env .envrc
# Generate to specific path
rsenv envrc production.env ~/project/.envrcSee: direnv Integration
List all files in hierarchy (parent chain).
Syntax:
rsenv files <file>Arguments:
-
<file>- Environment file (required)
Output: List of files in resolution order (parent β child)
Examples:
# List files
rsenv files production.env
# Edit all files in hierarchy
vim $(rsenv files production.env)
# Count files
rsenv files production.env | wc -lCreate parent-child relationships programmatically.
Syntax:
rsenv link <parent> <child1> [child2 ...]Arguments:
-
<parent>- Parent file (required) -
<child1>- First child file (required) -
[child2 ...]- Additional child files (optional)
Behavior:
Adds # rsenv: <parent> comment to each child file
Examples:
# Link single child
rsenv link base.env production.env
# Link multiple children
rsenv link base.env staging.env production.env
# Link with paths
rsenv link ../base.env production.envSee: Managing Links
| Command | Alias |
|---|---|
build |
b |
select |
s |
edit |
e |
tree |
t |
leaves |
l |
Examples:
rsenv b production.env # Same as rsenv build
rsenv t . # Same as rsenv tree
rsenv s . # Same as rsenv select| Code | Meaning |
|---|---|
0 |
Success |
1 |
General error (file not found, parse error, etc.) |
2 |
Command-line parsing error |
| Variable | Purpose | Example |
|---|---|---|
EDITOR |
Default editor for edit and tree-edit
|
export EDITOR=vim |
RUST_LOG |
Logging level for development | export RUST_LOG=debug |
Commands that accept directory arguments will search for:
- Files matching
*.env - Recursive search through subdirectories
- Hidden files are excluded
Export statements ready for shell sourcing:
export VAR1=value1
export VAR2=value2Hierarchical tree structure:
base.env
βββ cloud.env
βββ production.env
Linear chains (root β leaf):
base.env β cloud.env β production.env
Simple list (parent β child order):
base.env
cloud.env
production.env
Simple list of leaf files:
production.env
dev.env
- Quick Start - Getting started guide
- Building Environments - Using the build command
- Viewing Hierarchies - Visualization commands
- Interactive Selection - Interactive tools