diff --git a/README.md b/README.md
index 26927d19..0630bd88 100644
--- a/README.md
+++ b/README.md
@@ -3,342 +3,37 @@
# Terraform Switcher
-
+
-
-
-The `tfswitch` command line tool lets you switch between different versions of [terraform](https://www.terraform.io/).
-If you do not have a particular version of terraform installed, `tfswitch` will download and verify the version you desire.
-The installation is minimal and easy.
+The `tfswitch` command line tool lets you switch between different versions of [terraform](https://www.terraform.io/).
+If you do not have a particular version of terraform installed, `tfswitch` will download and verify the version you desire.
+The installation is minimal and easy.
Once installed, simply select the version you require from the dropdown and start using terraform.
-## Installation
-
-`tfswitch` 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](https://brew.sh/).
-
-
-```ruby
-brew install warrensbox/tap/tfswitch
-```
-
-### General Linux
-
-Installation for other linux operation systems.
-
-```sh
-curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash
-```
-By default installer script will try to download `tfswitch` binary into `/usr/local/bin`
-To install at custom path use below:
-```sh
-curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash -s -- -b $HOME/.local/bin latest
-```
-### Arch User Repository (AUR) packages for Arch Linux
-
-```sh
-# compiled from source
-yay tfswitch
-# precompiled
-yay tfswitch-bin
-```
-### Install from source
-
-Alternatively, you can install the binary from source [here](https://github.com/warrensbox/terraform-switcher/releases)
-
-[Having trouble installing](https://tfswitch.warrensbox.com/Troubleshoot/).
-
-## How to use:
-### Use dropdown menu to select version
-
-
-1. You can switch between different versions of terraform by typing the command `tfswitch` on your terminal.
-2. Select the version of terraform 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
-
-
-1. You can also supply the desired version as an argument on the command line.
-2. For example, `tfswitch 0.10.5` for version 0.10.5 of terraform.
-3. Hit **Enter** to switch.
-
-### See all versions including beta, alpha and release candidates(rc)
-
-
-1. Display all versions including beta, alpha and release candidates(rc).
-2. For example, `tfswitch -l` or `tfswitch --list-all` to see all versions.
-3. Hit **Enter** to select the desired version.
-
-### Use environment variable
-You can also set the `TF_VERSION` environment variable to your desired terraform version.
-For example:
-```bash
-export TF_VERSION=0.14.4
-tfswitch #will automatically switch to terraform version 0.14.4
-```
-### Install latest version only
-1. Install the latest stable version only.
-2. Run `tfswitch -u` or `tfswitch --latest`.
-3. Hit **Enter** to install.
-### Install latest implicit version for stable releases
-1. Install the latest implicit stable version.
-2. Ex: `tfswitch -s 0.13` or `tfswitch --latest-stable 0.13` downloads 0.13.6 (latest) version.
-3. Hit **Enter** to install.
-### Install latest implicit version for beta, alpha and release candidates(rc)
-1. Install the latest implicit pre-release version.
-2. Ex: `tfswitch -p 0.13` or `tfswitch --latest-pre 0.13` downloads 0.13.0-rc1 (latest) version.
-3. Hit **Enter** to install.
-### Show latest version only
-1. Just show what the latest version is.
-2. Run `tfswitch -U` or `tfswitch --show-latest`
-3. Hit **Enter** to show.
-### Show latest implicit version for stable releases
-1. Show the latest implicit stable version.
-2. Ex: `tfswitch -S 0.13` or `tfswitch --show-latest-stable 0.13` shows 0.13.6 (latest) version.
-3. Hit **Enter** to show.
-### Show latest implicit version for beta, alpha and release candidates(rc)
-1. Show the latest implicit pre-release version.
-2. Ex: `tfswitch -P 0.13` or `tfswitch --show-latest-pre 0.13` shows 0.13.0-rc1 (latest) version.
-3. Hit **Enter** to show.
-### Use version.tf file
-If a .tf file with the terraform constrain is included in the current directory, it should automatically download or switch to that terraform version. For example, the following should automatically switch terraform to the latest version:
-```ruby
-terraform {
- required_version = ">= 0.12.9"
-
- required_providers {
- aws = ">= 2.52.0"
- kubernetes = ">= 1.11.1"
- }
-}
-```
-
-
-### Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers)
-This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform 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 terraform. Ex: `tfswitch -b /Users/warrenveerasingam/bin/terraform 0.10.8 `
-4. Optionally, you can create a `.tfswitch.toml` file in your terraform directory(current directory) OR in your home directory(~/.tfswitch.toml). The toml file in the current directory has a higher precedence than toml file in the home directory
-5. Your `.tfswitch.toml` file should look like this:
-```ruby
-bin = "/Users/warrenveerasingam/bin/terraform"
-version = "0.11.3"
-```
-4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path
-
-**NOTE**
-1. For linux users that do not have write permission to `/usr/local/bin/`, `tfswitch` will attempt to install terraform at `$HOME/bin`. Run `export PATH=$PATH:$HOME/bin` to append bin to PATH
-2. For windows host, `tfswitch` need to be run under `Administrator` mode, and `$HOME/.tfswitch.toml` with `bin` must be defined (with a valid path) as minimum, below is an example for `$HOME/.tfswitch.toml` on windows
-
-```toml
-bin = "C:\\Users\\<%USRNAME%>\\bin\\terraform.exe"
-```
-### Use .tfswitchrc file
-
-
-1. Create a `.tfswitchrc` file containing the desired version
-2. For example, `echo "0.10.5" >> .tfswitchrc` for version 0.10.5 of terraform
-3. Run the command `tfswitch` in the same directory as your `.tfswitchrc`
-
-#### *Instead of a `.tfswitchrc` file, a `.terraform-version` file may be used for compatibility with [`tfenv`](https://github.com/tfutils/tfenv#terraform-version-file) and other tools which use it*
-
-### Use terragrunt.hcl file
-If a terragrunt.hcl file with the terraform constrain is included in the current directory, it should automatically download or switch to that terraform version. For example, the following should automatically switch terraform to the latest version 0.13:
-```ruby
-terragrunt_version_constraint = ">= 0.26, < 0.27"
-terraform_version_constraint = ">= 0.13, < 0.14"
-...
-```
-
-### Get the version from a subdirectory
-```bash
-tfswitch --chdir terraform_dir
-tfswitch -c terraform_dir
-```
-
-### Use custom mirror
-To install from a remote mirror other than the default(https://releases.hashicorp.com/terraform). Use the `-m` or `--mirror` parameter.
-Ex: `tfswitch --mirror https://example.jfrog.io/artifactory/hashicorp`
-
-### Set a default TF version for CICD pipeline
-1. When using a CICD pipeline, you may want a default or fallback version to avoid the pipeline from hanging.
-2. Ex: `tfswitch -d 1.2.3` or `tfswitch --default 1.2.3` installs version `1.2.3` when no other versions could be detected.
-[Also, see CICD example](#cicd)
-
-## Automation
-**Automatically switch with bash**
-
-Add the following to the end of your `~/.bashrc` file:
-(Use either `.tfswitchrc` or `.tfswitch.toml` or `.terraform-version`)
-
-```sh
-cdtfswitch(){
- builtin cd "$@";
- cdir=$PWD;
- if [ -e "$cdir/.tfswitchrc" ]; then
- tfswitch
- fi
-}
-alias cd='cdtfswitch'
-```
+## Documentation
+Click [here](https://tfswitch.warrensbox.com) for our extended documentation.
-**Automatically switch with zsh**
+## Quick Start
+### Dropdown Menu
+Just call `tfswitch` and select the desired terraform version via the dropdown menu.
+### Version on command line
+Call `tfswitch 1.7.0` to install terraform in the version 1.7.0. Replace version string with your desired version.
-Add the following to the end of your `~/.zshrc` file:
+## NOTE
+Going forward we will change the version identifier of `tfswitch` to align with the common go package versioning.
+Please be advised to change any automated implementation you might have that is relying on the `tfswitch` version string.
+**Old version string:** `0.1.2412`
+**New version string:** `v1.0.0` Note the `v` that is preceding all version numbers.
-```sh
-load-tfswitch() {
- local tfswitchrc_path=".tfswitchrc"
- if [ -f "$tfswitchrc_path" ]; then
- tfswitch
- fi
-}
-add-zsh-hook chpwd load-tfswitch
-load-tfswitch
-```
-> 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*
-```sh
-cd(){
- builtin cd "$@";
- cdir=$PWD;
- if [ -e "$cdir/.tfswitchrc" ]; then
- tfswitch
- fi
-}
-```
-
-**Automatically switch with fish shell**
-
-Add the following to the end of your `~/.config/fish/config.fish` file:
-
-```sh
-function switch_terraform --on-event fish_postexec
- string match --regex '^cd\s' "$argv" > /dev/null
- set --local is_command_cd $status
-
- if test $is_command_cd -eq 0
- if count *.tf > /dev/null
-
- grep -c "required_version" *.tf > /dev/null
- set --local tf_contains_version $status
-
- if test $tf_contains_version -eq 0
- command tfswitch
- end
- end
- end
-end
-```
-## CICD
-### Jenkins setup
-
-
-```sh
-#!/bin/bash
-
-echo "Installing tfswitch locally"
-wget https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh #Get the installer on to your machine
-
-chmod 755 install.sh #Make installer executable
-
-./install.sh -b `pwd`/.bin #Install tfswitch in a location you have permission
-
-CUSTOMBIN=`pwd`/.bin #set custom bin path
-
-export PATH=$PATH:$CUSTOMBIN #Add custom bin path to PATH environment
-
-$CUSTOMBIN/tfswitch -b $CUSTOMBIN/terraform 0.11.7 #or simply tfswitch -b $CUSTOMBIN/terraform 0.11.7
-
-#OR
-
-$CUSTOMBIN/tfswitch -d 0.11.7 -b $CUSTOMBIN/terraform #or simply tfswitch -d 0.11.7 -b $CUSTOMBIN/terraform
-
-terraform -v #testing version
-```
-
-### Circle CI setup
-
-
-
-
-Example config yaml
-```yaml
-version: 2
-jobs:
- build:
- docker:
- - image: ubuntu
-
- working_directory: /go/src/github.com/warrensbox/terraform-switcher
-
- steps:
- - checkout
- - run:
- command: |
- set +e
- apt-get update
- apt-get install -y wget
- rm -rf /var/lib/apt/lists/*
-
- echo "Installing tfswitch locally"
-
- wget https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh #Get the installer on to your machine
-
- chmod 755 install.sh #Make installer executable
-
- ./install.sh -b `pwd`/.bin #Install tfswitch in a location you have permission
-
- CUSTOMBIN=`pwd`/.bin #set custom bin path
-
- export PATH=$PATH:$CUSTOMBIN #Add custom bin path to PATH environment
-
- $CUSTOMBIN/tfswitch -b $CUSTOMBIN/terraform 0.11.7 #or simply tfswitch -b $CUSTOMBIN/terraform 0.11.7
-
- #OR
- $CUSTOMBIN/tfswitch -d 0.11.7 -b $CUSTOMBIN/terraform #or simply tfswitch -d 0.11.7 -b $CUSTOMBIN/terraform
-
- terraform -v #testing version
-```
-## Order of precedence
-
-| Order | Method |
-| --- | ----------- |
-| 1 | .tfswitch.toml |
-| 2 | .tfswitchrc |
-| 3 | .terraform-version |
-| 4 | Environment variable |
-
-With 1 being the highest precedence and 4 the lowest
-*(If you disagree with this order of precedence, please open an issue)*
-## How to contribute
+## How to contribute
An open source project becomes meaningful when people collaborate to improve the code.
-Feel free to look at the code, critique and make suggestions. Lets make `tfswitch` better!
+Feel free to look at the code, critique and make suggestions. Let's make `tfswitch` better!
See step-by-step instructions on how to contribute here: [Contribute](https://tfswitch.warrensbox.com/How-to-Contribute/)
## Additional Info
-
See how to *upgrade*, *uninstall*, *troubleshoot* here: [More info](https://tfswitch.warrensbox.com/Upgrade-or-Uninstall/)
-
## Issues
-
Please open *issues* here: [New Issue](https://github.com/warrensbox/terraform-switcher/issues)
diff --git a/www/docs/Continuous-Integration.md b/www/docs/Continuous-Integration.md
index e1f26bc9..487041c0 100644
--- a/www/docs/Continuous-Integration.md
+++ b/www/docs/Continuous-Integration.md
@@ -1,5 +1,5 @@
-### Jenkins setup
-
+## Jenkins setup
+![jenkins_tfswitch](static/jenkins_tfswitch.png)
```sh
#!/bin/bash
@@ -23,10 +23,9 @@ $CUSTOMBIN/tfswitch -d 0.11.7 -b $CUSTOMBIN/terraform #or simply tfswitch -d 0.
terraform -v #testing version
```
-### Circle CI setup
-
-
+## Circle CI setup
+![cirecleci_tfswitch](static/circleci_tfswitch.png)
Example config yaml
```yaml
@@ -65,4 +64,4 @@ jobs:
$CUSTOMBIN/tfswitch -d 0.11.7 -b $CUSTOMBIN/terraform #or simply tfswitch -d 0.11.7 -b $CUSTOMBIN/terraform
terraform -v #testing version
-```
\ No newline at end of file
+```
diff --git a/www/docs/How-to-Contribute.md b/www/docs/How-to-Contribute.md
index 9c1cc5a6..ca8bdc58 100644
--- a/www/docs/How-to-Contribute.md
+++ b/www/docs/How-to-Contribute.md
@@ -1,33 +1,34 @@
-## Step by step instructions
+## Step-by-step instructions
An open source project becomes meaningful when people collaborate to improve the code.
-Feel free to look at the code, critique and make suggestions. Lets make `tfswitch` better!
+Feel free to look at the code, critique and make suggestions. Let's make `tfswitch` better!
## Required version
```sh
-go version 1.13
+go version 1.22
```
### Step 1 - Create workspace
-*Skip this step if you already have a github go workspace*
-Create a github workspace.
-
+*Skip this step if you already have a GitHub go workspace*
+Create a GitHub workspace.
+
+![GitHub Workspace](static/contribute/tfswitch-workspace.gif "Create GitHub Workspace")
### Step 2 - Set GOPATH
-*Skip this step if you already have a github go workspace*
+*Skip this step if you already have a GitHub go workspace*
Export your GOPATH environment variable in your `go` directory.
```sh
export GOPATH=`pwd`
```
-
+![gopath](static/contribute/tfswitch-gopath.gif "gopath")
### Step 3 - Clone repository
Git clone this repository.
```sh
git clone git@github.com:warrensbox/terraform-switcher.git
```
-
+![gitclone](static/contribute/tfswitch-git-clone.gif "Git Clone")
### Step 4 - Get dependencies
Go get all the dependencies.
@@ -45,7 +46,7 @@ go vet -tests=false ./...
```sh
go test -v ./...
```
-
+![go get](static/contribute/tfswitch-go-get.gif)
### Step 5 - Build executable
Create a new branch.
@@ -59,22 +60,7 @@ go build -o test-tfswitch
```
Test the code and create a new pull request!
-
+![go build](static/contribute/tfswitch-build.gif)
### Contributors
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+Click here to see all contributors.
diff --git a/www/docs/Install.md b/www/docs/Install.md
deleted file mode 100644
index 5fbef88d..00000000
--- a/www/docs/Install.md
+++ /dev/null
@@ -1,37 +0,0 @@
-## Installation
-
-`tfswitch` 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.
-
-```ruby
-brew install warrensbox/tap/tfswitch
-```
-
-### Linux
-
-Installation for Linux operation systems.
-
-```sh
-curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash
-```
-
-### Arch User Repository (AUR) packages for Arch Linux
-
-```sh
-# compiled from source
-yay tfswitch
-
-# precompiled
-yay tfswitch-bin
-```
-
-### Install from source
-
-Alternatively, you can install the binary from the source here.
-
-[Having trouble installing](https://tfswitch.warrensbox.com/Troubleshoot/).
-
-
diff --git a/www/docs/Installation.md b/www/docs/Installation.md
new file mode 100644
index 00000000..6519b8aa
--- /dev/null
+++ b/www/docs/Installation.md
@@ -0,0 +1,39 @@
+# Installation
+`tfswitch` is available for Windows, macOS and Linux based operating systems.
+
+## Windows
+Download and extract the Windows version of `tfswitch` that is compatible with your system.
+We are building binaries for 386, amd64, arm6 and arm7 CPU structure.
+See the [release page](https://github.com/warrensbox/terraform-switcher/releases/latest) for your download.
+
+## Homebrew
+Installation for macOS is the easiest with Homebrew. If you do not have homebrew installed, click here.
+
+```ruby
+brew install warrensbox/tap/tfswitch
+```
+
+## Linux
+Installation for Linux operating systems.
+
+```sh
+curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash
+```
+
+## Arch User Repository (AUR) packages for Arch Linux
+
+```sh
+# compiled from source
+yay tfswitch
+
+# precompiled
+yay tfswitch-bin
+```
+
+## Install from source
+
+Alternatively, you can install the binary from the source here.
+
+[Having trouble installing](https://tfswitch.warrensbox.com/Troubleshoot/).
+
+
diff --git a/www/docs/Quick-Start.md b/www/docs/Quick-Start.md
deleted file mode 100644
index 4242098d..00000000
--- a/www/docs/Quick-Start.md
+++ /dev/null
@@ -1,193 +0,0 @@
-
-## How to use:
-### Use dropdown menu to select version
-
-
-1. You can switch between different versions of terraform by typing the command `tfswitch` on your terminal.
-2. Select the version of terraform 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
-
-
-1. You can also supply the desired version as an argument on the command line.
-2. For example, `tfswitch 0.10.5` for version 0.10.5 of terraform.
-3. Hit **Enter** to switch.
-
-### See all versions including beta, alpha and release candidates(rc)
-
-
-1. Display all versions including beta, alpha and release candidates(rc).
-2. For example, `tfswitch -l` or `tfswitch --list-all` to see all versions.
-3. Hit **Enter** to select the desired version.
-### Use environment variables
-You can also set the `TF_VERSION` environment variable to your desired terraform version.
-For example:
-```bash
-export TF_VERSION=0.14.4
-tfswitch #will automatically switch to terraform version 0.14.4
-```
-### Install latest version only
-1. Install the latest stable version only.
-2. Run `tfswitch -u` or `tfswitch --latest`.
-3. Hit **Enter** to install.
-### Install latest implicit version for stable releases
-1. Install the latest implicit stable version.
-2. Ex: `tfswitch -s 0.13` or `tfswitch --latest-stable 0.13` downloads 0.13.6 (latest) version.
-3. Hit **Enter** to install.
-### Install latest implicit version for beta, alpha and release candidates(rc)
-1. Install the latest implicit pre-release version.
-2. Ex: `tfswitch -p 0.13` or `tfswitch --latest-pre 0.13` downloads 0.13.0-rc1 (latest) version.
-3. Hit **Enter** to install.
-### Show latest version only
-1. Just show what the latest version is.
-2. Run `tfswitch -U` or `tfswitch --show-latest`
-3. Hit **Enter** to show.
-### Show latest implicit version for stable releases
-1. Show the latest implicit stable version.
-2. Ex: `tfswitch -S 0.13` or `tfswitch --show-latest-stable 0.13` shows 0.13.6 (latest) version.
-3. Hit **Enter** to show.
-### Show latest implicit version for beta, alpha and release candidates(rc)
-1. Show the latest implicit pre-release version.
-2. Ex: `tfswitch -P 0.13` or `tfswitch --show-latest-pre 0.13` shows 0.13.0-rc1 (latest) version.
-3. Hit **Enter** to show.
-### Use version.tf file
-If a .tf file with the terraform constrain is included in the current directory, it should automatically download or switch to that terraform version. For example, the following should automatically switch terraform to the lastest version:
-```
-terraform {
- required_version = ">= 0.12.9"
-
- required_providers {
- aws = ">= 2.52.0"
- kubernetes = ">= 1.11.1"
- }
-}
-```
-
-
-### Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers)
-This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform 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 terraform. Ex: `tfswitch -b /Users/warrenveerasingam/bin/terraform 0.10.8 `
-4. Optionally, you can create a `.tfswitch.toml` file in your terraform directory(current directory) OR in your home directory(~/.tfswitch.toml). The toml file in the current directory has a higher precedence than toml file in the home directory
-5. Your `.tfswitch.toml` file should look like this:
-```ruby
-bin = "/Users/warrenveerasingam/bin/terraform"
-version = "0.11.3"
-```
-4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path
-
-**NOTE**
-1. For linux users that do not have write permission to `/usr/local/bin/`, `tfswitch` will attempt to install terraform at `$HOME/bin`. Run `export PATH=$PATH:$HOME/bin` to append bin to PATH
-2. For windows host, `tfswitch` need to be run under `Administrator` mode, and `$HOME/.tfswitch.toml` with `bin` must be defined (with a valid path) as minimum, below is an example for `$HOME/.tfswitch.toml` on windows
-
-```toml
-bin = "C:\\Users\\<%USRNAME%>\\bin\\terraform.exe"
-```
-### Use .tfswitchrc file
-
-
-1. Create a `.tfswitchrc` file containing the desired version
-2. For example, `echo "0.10.5" >> .tfswitchrc` for version 0.10.5 of terraform
-3. Run the command `tfswitch` in the same directory as your `.tfswitchrc`
-
-*Instead of a `.tfswitchrc` file, a `.terraform-version` file may be used for compatibility with [`tfenv`](https://github.com/tfutils/tfenv#terraform-version-file) and other tools which use it*
-
-### Use terragrunt.hcl file
-If a terragrunt.hcl file with the terraform constrain is included in the current directory, it should automatically download or switch to that terraform version. For example, the following should automatically switch terraform to the lastest version 0.13:
-```ruby
-terragrunt_version_constraint = ">= 0.26, < 0.27"
-terraform_version_constraint = ">= 0.13, < 0.14"
-...
-```
-
-### Get the version from a subdirectory
-```bash
-tfswitch --chdir terraform_dir
-tfswitch -c terraform_dir
-```
-
-### Use custom mirror
-To install from a remote mirror other than the default(https://releases.hashicorp.com/terraform). Use the `-m` or `--mirror` parameter.
-Ex: `tfswitch --mirror https://example.jfrog.io/artifactory/hashicorp`
-
-### Set a default TF version for CICD pipeline
-1. When using a CICD pipeline, you may want a default or fallback version to avoid the pipeline from hanging.
-2. Ex: `tfswitch -d 1.2.3` or `tfswitch --default 1.2.3` installs version `1.2.3` when no other versions could be detected.
-[Also, see CICD example](../continuous-integration)
-
-**Automatically switch with bash**
-
-Add the following to the end of your `~/.bashrc` file:
-(Use either `.tfswitchrc` or `.tfswitch.toml` or `.terraform-version`)
-
-```sh
-cdtfswitch(){
- builtin cd "$@";
- cdir=$PWD;
- if [ -e "$cdir/.tfswitchrc" ]; then
- tfswitch
- fi
-}
-alias cd='cdtfswitch'
-```
-
-**Automatically switch with zsh**
-
-Add the following to the end of your `~/.zshrc` file:
-
-```sh
-load-tfswitch() {
- local tfswitchrc_path=".tfswitchrc"
-
- if [ -f "$tfswitchrc_path" ]; then
- tfswitch
- fi
-}
-add-zsh-hook chpwd load-tfswitch
-load-tfswitch
-```
-> 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*
-```sh
-cd(){
- builtin cd "$@";
- cdir=$PWD;
- if [ -e "$cdir/.tfswitchrc" ]; then
- tfswitch
- fi
-}
-```
-**Automatically switch with fish shell**
-
-Add the following to the end of your `~/.config/fish/config.fish` file:
-
-```sh
-function switch_terraform --on-event fish_postexec
- string match --regex '^cd\s' "$argv" > /dev/null
- set --local is_command_cd $status
-
- if test $is_command_cd -eq 0
- if count *.tf > /dev/null
-
- grep -c "required_version" *.tf > /dev/null
- set --local tf_contains_version $status
-
- if test $tf_contains_version -eq 0
- command tfswitch
- end
- end
- end
-end
-```
diff --git a/www/docs/Troubleshoot.md b/www/docs/Troubleshoot.md
index b646068d..550b3a1c 100644
--- a/www/docs/Troubleshoot.md
+++ b/www/docs/Troubleshoot.md
@@ -43,6 +43,5 @@ export PATH=$PATH:$HOME/.bin #Export your .bin into your path
```
-See the custom directory option `-b`:
-
-
+See the custom directory option `-b`:
+![custom directory](static/tfswitch-v7.gif "Custom binary path")
diff --git a/www/docs/index.md b/www/docs/index.md
index 0731f2cf..455e45a0 100644
--- a/www/docs/index.md
+++ b/www/docs/index.md
@@ -1,6 +1,7 @@
# Introduction to tfswitch
-
+![Logo](static/logo.png)
+
The `tfswitch` command line tool lets you switch between different versions of terraform.
If you do not have a particular version of terraform installed, `tfswitch` lets you download the version you desire.
diff --git a/www/docs/static/circleci_tfswitch.png b/www/docs/static/circleci_tfswitch.png
new file mode 100644
index 00000000..c2996142
Binary files /dev/null and b/www/docs/static/circleci_tfswitch.png differ
diff --git a/www/docs/static/contribute/tfswitch-build.gif b/www/docs/static/contribute/tfswitch-build.gif
new file mode 100644
index 00000000..0212583f
Binary files /dev/null and b/www/docs/static/contribute/tfswitch-build.gif differ
diff --git a/www/docs/static/contribute/tfswitch-git-clone.gif b/www/docs/static/contribute/tfswitch-git-clone.gif
new file mode 100644
index 00000000..68748b30
Binary files /dev/null and b/www/docs/static/contribute/tfswitch-git-clone.gif differ
diff --git a/www/docs/static/contribute/tfswitch-go-get.gif b/www/docs/static/contribute/tfswitch-go-get.gif
new file mode 100644
index 00000000..85626fb6
Binary files /dev/null and b/www/docs/static/contribute/tfswitch-go-get.gif differ
diff --git a/www/docs/static/contribute/tfswitch-gopath.gif b/www/docs/static/contribute/tfswitch-gopath.gif
new file mode 100644
index 00000000..cfa1f46b
Binary files /dev/null and b/www/docs/static/contribute/tfswitch-gopath.gif differ
diff --git a/www/docs/static/contribute/tfswitch-workspace.gif b/www/docs/static/contribute/tfswitch-workspace.gif
new file mode 100644
index 00000000..cf5e98c4
Binary files /dev/null and b/www/docs/static/contribute/tfswitch-workspace.gif differ
diff --git a/www/docs/static/jenkins_tfswitch.png b/www/docs/static/jenkins_tfswitch.png
new file mode 100644
index 00000000..366bcdd8
Binary files /dev/null and b/www/docs/static/jenkins_tfswitch.png differ
diff --git a/www/docs/static/tfswitch-v4.gif b/www/docs/static/tfswitch-v4.gif
new file mode 100644
index 00000000..849db169
Binary files /dev/null and b/www/docs/static/tfswitch-v4.gif differ
diff --git a/www/docs/static/tfswitch-v5.gif b/www/docs/static/tfswitch-v5.gif
new file mode 100644
index 00000000..90b80de9
Binary files /dev/null and b/www/docs/static/tfswitch-v5.gif differ
diff --git a/www/docs/static/tfswitch-v6.gif b/www/docs/static/tfswitch-v6.gif
new file mode 100644
index 00000000..0bf7833d
Binary files /dev/null and b/www/docs/static/tfswitch-v6.gif differ
diff --git a/www/docs/static/tfswitch-v7.gif b/www/docs/static/tfswitch-v7.gif
new file mode 100644
index 00000000..d23e59e5
Binary files /dev/null and b/www/docs/static/tfswitch-v7.gif differ
diff --git a/www/docs/static/tfswitch-v8.gif b/www/docs/static/tfswitch-v8.gif
new file mode 100644
index 00000000..6715f069
Binary files /dev/null and b/www/docs/static/tfswitch-v8.gif differ
diff --git a/www/docs/static/tfswitch.gif b/www/docs/static/tfswitch.gif
new file mode 100644
index 00000000..bf174527
Binary files /dev/null and b/www/docs/static/tfswitch.gif differ
diff --git a/www/docs/static/versiontf.gif b/www/docs/static/versiontf.gif
new file mode 100644
index 00000000..2c0ae412
Binary files /dev/null and b/www/docs/static/versiontf.gif differ
diff --git a/www/docs/usage/ci-cd.md b/www/docs/usage/ci-cd.md
new file mode 100644
index 00000000..d4adfaa5
--- /dev/null
+++ b/www/docs/usage/ci-cd.md
@@ -0,0 +1,73 @@
+## Set a default TF version for CI/CD pipeline
+1. When using a CI/CD pipeline, you may want a default or fallback version to avoid the pipeline from hanging.
+2. Ex: `tfswitch -d 1.2.3` or `tfswitch --default 1.2.3` installs version `1.2.3` when no other versions could be detected.
+[Also, see CICD example](../continuous-integration)
+
+## Automatically switch with bash
+
+Add the following to the end of your `~/.bashrc` file:
+(Use either `.tfswitchrc` or `.tfswitch.toml` or `.terraform-version`)
+
+```sh
+cdtfswitch(){
+ builtin cd "$@";
+ cdir=$PWD;
+ if [ -e "$cdir/.tfswitchrc" ]; then
+ tfswitch
+ fi
+}
+alias cd='cdtfswitch'
+```
+
+## Automatically switch with zsh
+
+Add the following to the end of your `~/.zshrc` file:
+
+```sh
+load-tfswitch() {
+ local tfswitchrc_path=".tfswitchrc"
+
+ if [ -f "$tfswitchrc_path" ]; then
+ tfswitch
+ fi
+}
+add-zsh-hook chpwd load-tfswitch
+load-tfswitch
+```
+> 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
+```sh
+cd(){
+ builtin cd "$@";
+ cdir=$PWD;
+ if [ -e "$cdir/.tfswitchrc" ]; then
+ tfswitch
+ fi
+}
+```
+## Automatically switch with fish shell
+
+Add the following to the end of your `~/.config/fish/config.fish` file:
+
+```sh
+function switch_terraform --on-event fish_postexec
+ string match --regex '^cd\s' "$argv" > /dev/null
+ set --local is_command_cd $status
+
+ if test $is_command_cd -eq 0
+ if count *.tf > /dev/null
+
+ grep -c "required_version" *.tf > /dev/null
+ set --local tf_contains_version $status
+
+ if test $tf_contains_version -eq 0
+ command tfswitch
+ end
+ end
+ end
+end
+```
diff --git a/www/docs/usage/commandline.md b/www/docs/usage/commandline.md
new file mode 100644
index 00000000..664a9619
--- /dev/null
+++ b/www/docs/usage/commandline.md
@@ -0,0 +1,63 @@
+## Use dropdown menu to select version
+![tfswitch](../static/tfswitch.gif "tfswitch")
+
+1. You can switch between different versions of terraform by typing the command `tfswitch` on your terminal.
+2. Select the version of terraform 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
+
+
+1. You can also supply the desired version as an argument on the command line.
+2. For example, `tfswitch 0.10.5` for version 0.10.5 of terraform.
+3. Hit **Enter** to switch.
+
+## See all versions including beta, alpha and release candidates(rc)
+
+
+1. Display all versions including beta, alpha and release candidates(rc).
+2. For example, `tfswitch -l` or `tfswitch --list-all` to see all versions.
+3. Hit **Enter** to select the desired version.
+
+## Use environment variables
+You can also set the `TF_VERSION` environment variable to your desired terraform version.
+For example:
+```bash
+export TF_VERSION=0.14.4
+tfswitch #will automatically switch to terraform version 0.14.4
+```
+## Install latest version only
+1. Install the latest stable version only.
+2. Run `tfswitch -u` or `tfswitch --latest`.
+3. Hit **Enter** to install.
+
+## Install latest implicit version for stable releases
+1. Install the latest implicit stable version.
+2. Ex: `tfswitch -s 0.13` or `tfswitch --latest-stable 0.13` downloads 0.13.6 (latest) version.
+3. Hit **Enter** to install.
+
+## Install latest implicit version for beta, alpha and release candidates(rc)
+1. Install the latest implicit pre-release version.
+2. Ex: `tfswitch -p 0.13` or `tfswitch --latest-pre 0.13` downloads 0.13.0-rc1 (latest) version.
+3. Hit **Enter** to install.
+
+## Show latest version only
+1. Just show what the latest version is.
+2. Run `tfswitch -U` or `tfswitch --show-latest`
+3. Hit **Enter** to show.
+
+## Show latest implicit version for stable releases
+1. Show the latest implicit stable version.
+2. Ex: `tfswitch -S 0.13` or `tfswitch --show-latest-stable 0.13` shows 0.13.6 (latest) version.
+3. Hit **Enter** to show.
+
+## Show latest implicit version for beta, alpha and release candidates(rc)
+1. Show the latest implicit pre-release version.
+2. Ex: `tfswitch -P 0.13` or `tfswitch --show-latest-pre 0.13` shows 0.13.0-rc1 (latest) version.
+3. Hit **Enter** to show.
+
+## Use custom mirror
+To install from a remote mirror other than the default(https://releases.hashicorp.com/terraform). Use the `-m` or `--mirror` parameter.
+Ex: `tfswitch --mirror https://example.jfrog.io/artifactory/hashicorp`
diff --git a/www/docs/usage/config-files.md b/www/docs/usage/config-files.md
new file mode 100644
index 00000000..9f34ea30
--- /dev/null
+++ b/www/docs/usage/config-files.md
@@ -0,0 +1,65 @@
+## Get the version from a subdirectory
+While using the file configuration it might be necessary to change the working directory. You can do that with the `--chdir` or `-c` parameter.
+```bash
+tfswitch --chdir terraform_dir
+tfswitch -c terraform_dir
+```
+
+## Use version.tf file
+If a .tf file with the terraform constraints is included in the current directory, it should automatically download or switch to that terraform version.
+For example, the following should automatically switch terraform to the lastest version:
+```
+terraform {
+ required_version = ">= 0.12.9"
+
+ required_providers {
+ aws = ">= 2.52.0"
+ kubernetes = ">= 1.11.1"
+ }
+}
+```
+
+![versiontf](../static/versiontf.gif "Use version.tf")
+
+## Use .tfswitchrc file
+![tfswitchrc](../static/tfswitch-v6.gif)
+
+1. Create a `.tfswitchrc` file containing the desired version
+2. For example, `echo "0.10.5" >> .tfswitchrc` for version 0.10.5 of terraform
+3. Run the command `tfswitch` in the same directory as your `.tfswitchrc`
+
+*Instead of a `.tfswitchrc` file, a `.terraform-version` file may be used for compatibility with [`tfenv`](https://github.com/tfutils/tfenv#terraform-version-file) and other tools which use it*
+
+## Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers)
+This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation
+
+![toml1](../static/tfswitch-v7.gif)
+![toml2](../static/tfswitch-v8.gif)
+
+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 terraform. Ex: `tfswitch -b /Users/warrenveerasingam/bin/terraform 0.10.8 `
+4. Optionally, you can create a `.tfswitch.toml` file in your terraform directory(current directory) OR in your home directory(~/.tfswitch.toml). The toml file in the current directory has a higher precedence than toml file in the home directory
+5. Your `.tfswitch.toml` file should look like this:
+```ruby
+bin = "/Users/warrenveerasingam/bin/terraform"
+version = "0.11.3"
+```
+4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path
+
+**NOTE**
+1. For linux users that do not have write permission to `/usr/local/bin/`, `tfswitch` will attempt to install terraform at `$HOME/bin`. Run `export PATH=$PATH:$HOME/bin` to append bin to PATH
+2. For windows host, `tfswitch` need to be run under `Administrator` mode, and `$HOME/.tfswitch.toml` with `bin` must be defined (with a valid path) as minimum, below is an example for `$HOME/.tfswitch.toml` on windows
+
+```toml
+bin = "C:\\Users\\<%USRNAME%>\\bin\\terraform.exe"
+```
+
+## Use terragrunt.hcl file
+If a terragrunt.hcl file with the terraform constraint is included in the current directory, it should automatically download or switch to that terraform version.
+For example, the following should automatically switch terraform to the lastest version 0.13:
+```ruby
+terragrunt_version_constraint = ">= 0.26, < 0.27"
+terraform_version_constraint = ">= 0.13, < 0.14"
+...
+```
diff --git a/www/docs/usage/general.md b/www/docs/usage/general.md
new file mode 100644
index 00000000..5fdb972e
--- /dev/null
+++ b/www/docs/usage/general.md
@@ -0,0 +1,11 @@
+## Order of variable precedence
+
+| Order | Method |
+| --- | ----------- |
+| 1 | .tfswitch.toml |
+| 2 | .tfswitchrc |
+| 3 | .terraform-version |
+| 4 | Environment variable |
+
+With 1 being the highest precedence and 4 the lowest
+*(If you disagree with this order of precedence, please open an issue)*
diff --git a/www/mkdocs.yml b/www/mkdocs.yml
index d611190f..43c356a4 100644
--- a/www/mkdocs.yml
+++ b/www/mkdocs.yml
@@ -6,22 +6,25 @@ repo_url: https://github.com/warrensbox/terraform-switcher
site_url: https://tfswitch.warrensbox.com
theme:
- name: material
- palette:
- primary: indigo
- favicon: static/favicon_tfswitch_16.png
- logo: static/logo.png
+ name: material
+ palette:
+ primary: indigo
+ favicon: static/favicon_tfswitch_16.png
+ logo: static/logo.png
nav:
- - index.md
- - Install.md
- - Quick-Start.md
- - Continuous-Integration.md
- - Upgrade-or-Uninstall.md
- - How-to-Contribute.md
- - Troubleshoot.md
-
+ - Home: index.md
+ - Installation: Installation.md
+ - Usage:
+ - General: usage/general.md
+ - Command line: usage/commandline.md
+ - Config files: usage/config-files.md
+ - CI/CD: usage/ci-cd.md
+ - CI/CD Examples: Continuous-Integration.md
+ - Upgrade-or-Uninstall.md
+ - How-to-Contribute.md
+ - Troubleshoot.md
+
google_analytics:
- - UA-120055973-1
- - auto
-
\ No newline at end of file
+ - UA-120055973-1
+ - auto