Skip to content
/ ctx Public

Run commands with configured environment variables

Notifications You must be signed in to change notification settings

jbordoe/ctx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ctx

Fast context switching with predefined environment variable groups

Usage

ctx [OPTIONS] -- COMMAND

Usectx with any .env file containing your environment variables.

Consider having multiple .env files for different contexts (staging, docker etc) and using ctx to easily switch.

Examples

NOTE: In these examples we include our command as a string argument to bash to ensure the variables are interpolated after Rust updates the environment. In other instances you can just pass your command as is.

Run a command using the variables defined in .env.en.example

ctx -f .env.example -- bash -c 'echo "$GREETING, $SUBJECT!"'

Should display

Hello, World!

Now run the same command using the variables defined in .env.de.example

ctx -f .env.de.example -- bash -c 'echo "$GREETING, $SUBJECT!"'

Should display

Hallo, Welt!

Again, using the variables defined in .env.de.example, but override the value for GREETING

ctx -f .env.de.example -e GREETING=Moin -- bash -c 'echo "$GREETING, $SUBJECT!"'

Should display

Moin, Welt!

Use ctx --help for more information

About

Run commands with configured environment variables

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages