Git Product home page Git Product logo

tgswitch's Introduction

Build Status Go Report Card CircleCI

Terragrunt Switcher

drawing

The tgswitch command line tool lets you switch between different versions of terragrunt. If you do not have a particular version of terragrunt installed, tgswitch will download the version you desire. The installation is minimal and easy. Once installed, simply select the version you require from the dropdown and start using terragrunt.

See installation guide here: tgswitch installation

Installation

tgswitch is available for MacOS and Linux based operating systems.

Homebrew

Installation for MacOS is the easiest with Homebrew. If you do not have homebrew installed, click here.

brew install warrensbox/tap/tgswitch

Linux

Installation for other linux operation systems.

curl -L https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh | bash

Install from source

Alternatively, you can install the binary from source here

How to use:

Use dropdown menu to select version

drawing

  1. You can switch between different versions of terragrunt by typing the command tgswitch on your terminal.
  2. Select the version of terragrunt you require by using the up and down arrow.
  3. Hit Enter to select the desired version.

The most recently selected versions are presented at the top of the dropdown.

Supply version on command line

drawing

  1. You can also supply the desired version as an argument on the command line.
  2. For example, tgswitch 0.10.7 for version 0.10.7 of terragrunt.
  3. Hit Enter to switch version.

Use custom installation location (For non-admin - users with limited privilege on their computers)

You can specify a custom binary path for your terragrunt installation

  1. Create a custom binary path. Ex: mkdir /Users/warrenveerasingam/bin (replace warrenveerasingam with your username)
  2. Add the path to your PATH. Ex: export PATH=$PATH:/Users/warrenveerasingam/bin (add this to your bash profile or zsh profile)
  3. Pass -b or --bin parameter with your custom path to install terragrunt. Ex: tgswitch -b /Users/warrenveerasingam/bin/terragrunt 0.14.1

Use .tgswitchrc file

drawing

  1. Create a .tgswitchrc file containing the desired version
  2. For example, echo "0.14.1" >> .tgswitchrc for version 0.14.1 of terragrunt
  3. Run the command tgswitch in the same directory as your .tgswitchrc

Automatically switch with bash

Add the following to the end of your ~/.bashrc file: (Use .tgswitchrc)

cdtgswitch(){
  builtin cd "$@";
  cdir=$PWD;
  if [ -f "$cdir/.tgswitchrc" ]; then
    tgswitch
  fi
}
alias cd='cdtgswitch'

drawing

Automatically switch with zsh

Add the following to the end of your ~/.zshrc file:

load-tgswitch() {
  local tgswitchrc_path=".tgswitchrc"

  if [ -f "$tgswitchrc_path" ]; then
    tgswitch
  fi
}
add-zsh-hook chpwd load-tgswitch
load-tgswitch

NOTE: if you see an error like this: command not found: add-zsh-hook, then you might be on an older version of zsh (see below), or you simply need to load add-zsh-hook by adding this to your .zshrc:

autoload -U add-zsh-hook

older version of zsh

cd(){
  builtin cd "$@";
  cdir=$PWD;
  if [ -f "$cdir/.tgswitchrc" ]; then
    tgswitch
  fi
}

Additional Info

See how to upgrade, uninstall, troubleshoot here:More info

Issues

Please open issues here: New Issue

tgswitch's People

Contributors

dependabot[bot] avatar lumasepa avatar stashedup avatar warrensbox avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.