Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

jycamier/wrapper

Repository files navigation

Wrapper - A profile Manager for Any Binary

Wrapper is a transparent configuration profile manager for any CLI binary. It allows you to manage multiple environment configurations (profiles) and seamlessly switch between them.

small

Features

  • πŸ”§ Universal: Works with any binary (vault, aws, kubectl, etc.)
  • πŸ“ Profile Management: Create, list, and switch between profiles
  • πŸ”„ Transparent Execution: Acts as a pass-through wrapper
  • πŸ’Ύ Simple Storage: Profiles stored as .env files
  • 🎯 Smart Resolution: Automatically finds the real binary in PATH

Configuration Structure

Wrapper stores all profiles in ~/.config/wrapper/:

$HOME/.config/wrapper/
β”œβ”€β”€ aliases.bash
β”œβ”€β”€ aliases.fish
β”œβ”€β”€ aliases.zsh
β”œβ”€β”€ gcloud
β”‚ β”œβ”€β”€ current.env -> $HOME/.config/wrapper/gcloud/prod.env
β”‚ β”œβ”€β”€ dev.env
β”‚ β”œβ”€β”€ preprod.env
β”‚ └── prod.env
└── vault
 β”œβ”€β”€ current.env -> $HOME/.config/wrapper/vault/prod.env
 β”œβ”€β”€ dev.env
 β”œβ”€β”€ prod.env
 └── test.env
  • aliases.* - Shell-specific alias files
  • <binary>/ - Directory for each wrapped binary
  • <binary>/*.env - Profile files (KEY=VALUE format)
  • <binary>/current.env - Symlink to the active profile

Installation

Homebrew

brew tap jycamier/homebrew-tap
brew install wrapper

Docker

docker run --rm ghcr.io/jycamier/wrapper:latest version

Manual

Check out the releases page.

Quick Start

1. Create a profile

Imagine you have a staging and production instances of Vault. You can create a profile for each instance.

wrapper vault profile create staging

This command creates ~/.config/wrapper/vault/staging.env. Then you can edit it to configure the environment variable you need for your profile.

VAULT_ADDR=https://vault.example.com
VAULT_NAMESPACE=admin

2. Set the profile

You need to set the profile to use for the current session.

wrapper vault profile set staging
wrapper vault status ## 

Then you can calls vault status command with staging environment loaded:

wrapper vault status

3. Generate aliases

wrapper alias

This creates alias command files in ~/.config/wrapper/ for bash, zsh, and fish. These commands wrap the initial command with the profile you set.

Here's an example of the alias.bash file:

# Wrapper aliases for Bash
# Generated by wrapper - DO NOT EDIT MANUALLY
# Regenerate with: wrapper alias
vault() { wrapper vault "$@"; }

5. Set the profile

vault profile set prod

6. Use it!

vault status
# Executes /usr/bin/vault status with prod environment

Usage

Wrapper Commands

# List all configured binaries
wrapper list
# Generate shell alias files
wrapper alias

Profile Commands

# List profiles (with colors and current highlighted)
wrapper <binary> profile
# Create a new profile
wrapper <binary> profile create <name>
# Set current profile
wrapper <binary> profile set <name>

FAQ

How to managed vault token by wrapper?

It's possible to create a token contextualized to a profile. You need to create a token_helper like this one, which is a way to customize the token storage.

So, you can create this token helper:

curl https://gist.githubusercontent.com/jycamier/0e8e03526d31a4bbcdbdaa4f48ca630e/raw/21634540afb97d0cf9e5bcd7f8ffe9c6728e6ba0/.vault-token-helper.sh > $HOME/.vault-token-helper.sh
echo "token_helper = \"$(echo $HOME)/.vault-token-helper.sh\"" >> ${HOME}/.vault

Then you can set a VAULT_ENV in your profile to stock the token in a dedicated file..

VAULT_ADDR=https://vault.staging.exemple.com
VAULT_NAMESPACE=admin
VAULT_ENV=staging

License

See LICENSE file.

About

a transparent configuration profile manager for any CLI binary

Resources

License

Stars

Watchers

Forks

Packages

Contributors

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /