diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 09cdb3d..c01e001 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -9,7 +9,7 @@ on:
jobs:
- hubapp-build:
+ tgswitch-build:
name: Workflow
runs-on: ubuntu-latest
steps:
diff --git a/test-data/test_tfswitchtoml/.tgswitch.toml b/test-data/test_tgswitchtoml/.tgswitch.toml
similarity index 100%
rename from test-data/test_tfswitchtoml/.tgswitch.toml
rename to test-data/test_tgswitchtoml/.tgswitch.toml
diff --git a/test-tgswitch.sh b/test-tgswitch.sh
index 4d90ec6..c1789bf 100755
--- a/test-tgswitch.sh
+++ b/test-tgswitch.sh
@@ -25,7 +25,7 @@ function runtestdir(){
./build/tgswitch -c ./test-data/"$dir" || exit 1
version=$(terragrunt -v | awk '{print $3}')
echo "$version"
- sleep 2
+ sleep 1
if [[ "$version" == "$expected_version" ]]; then
echo "Switch successful"
else
@@ -47,7 +47,7 @@ function runtestenv(){
./build/tgswitch || exit 1
version=$(terragrunt -v | awk '{print $3}')
echo "$version"
- sleep 2
+ sleep 1
if [[ "$version" == "$expected_version" ]]; then
echo "Switch successful"
else
@@ -66,7 +66,7 @@ function runtestarg(){
./build/tgswitch "$arg"|| exit 1
version=$(terragrunt -v | awk '{print $3}')
echo "$version"
- sleep 2
+ sleep 1
if [[ "$version" == "$expected_version" ]]; then
echo "Switch successful"
else
@@ -78,7 +78,7 @@ function runtestarg(){
runtestdir "terragrunt version" "test_terragrunt-version" "v0.36.0"
runtestdir "terragrunt hcl" "test_terragrunt_hcl" "v0.36.0"
-runtestdir "tfswitchrc" "test_tgswitchrc" "v0.33.0"
-runtestdir ".toml" "test_tfswitchtoml" "v0.34.0"
+runtestdir "tgswitchrc" "test_tgswitchrc" "v0.33.0"
+runtestdir ".toml" "test_tgswitchtoml" "v0.34.0"
runtestenv "env variable" "0.37.1" "v0.37.1"
runtestarg "passing argument" "0.36.1" "v0.36.1"
diff --git a/www/docs/Install.md b/www/docs/Install.md
new file mode 100644
index 0000000..cc14b01
--- /dev/null
+++ b/www/docs/Install.md
@@ -0,0 +1,25 @@
+## 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.
+
+```ruby
+brew install warrensbox/tap/tgswitch
+```
+
+### Linux
+
+Installation for Linux operation systems.
+
+```sh
+curl -L https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh | bash
+```
+
+### Install from source
+
+Alternatively, you can install the binary from the source here.
+
+[Having trouble installing](https://tgswitch.warrensbox.com/Troubleshoot/).
diff --git a/www/docs/Quick-Start.md b/www/docs/Quick-Start.md
new file mode 100644
index 0000000..9475ebf
--- /dev/null
+++ b/www/docs/Quick-Start.md
@@ -0,0 +1,143 @@
+
+## How to use:
+### Use dropdown menu to select version
+
+
+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
+
+
+1. You can also supply the desired version as an argument on the command line.
+2. For example, `tgswitch 0.37.1` for version 0.37.1 of terragrunt.
+3. Hit **Enter** to switch.
+
+### Use environment variables
+
+You can also set the `TG_VERSION` environment variable to your desired terragrunt version.
+For example:
+```bash
+export TG_VERSION=0.37.0
+tgswitch #will automatically switch to terragrunt version 0.37.0
+```
+
+### Use .tgswitch.toml file (For non-admin AND Apple M1 users with limited privilege on their computers)
+Specify a custom binary path for your terragrunt installation
+
+
+
+
+1. Create a custom binary path. Ex: `mkdir /Users/uveerum/bin` (replace uveerum with your username)
+2. Add the path to your PATH. Ex: `export PATH=$PATH:/Users/uveerum/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/uveerum/bin/terragrunt 0.34.0 `
+4. Optionally, you can create a `.tgswitch.toml` file in your terragrunt directory(current directory) OR in your home directory(~/.tgswitch.toml). The toml file in the current directory has a higher precedence than toml file in the home directory
+5. Your `.tgswitch.toml` file should look like this:
+```ruby
+bin = "/usr/local/bin/terragrunt"
+version = "0.34.0"
+```
+4. Run `tgswitch` and it should automatically install the required terragrunt version in the specified binary path
+
+**NOTE**
+1. For linux users that do not have write permission to `/usr/local/bin/`, `tgswitch` will attempt to install terragrunt at `$HOME/bin`. Run `export PATH=$PATH:$HOME/bin` to append bin to PATH
+2. For windows host, `tgswitch` need to be run under `Administrator` mode, and `$HOME/.tgswitch.toml` with `bin` must be defined (with a valid path) as minimum, below is an example for `$HOME/.tgswitch.toml` on windows
+
+```toml
+bin = "C:\\Users\\<%USRNAME%>\\bin\\terragrunt.exe"
+```
+### Use .tgswitchrc file
+
+
+1. Create a `.tgswitchrc` file containing the desired version
+2. For example, `echo "0.33.0" >> .tgswitchrc` for version 0.33.0 of terragrunt
+3. Run the command `tgswitch` in the same directory as your `.tgswitchrc`
+
+*Instead of a `.tgswitchrc` file, a `.terragrunt-version` file may be used as well*
+
+### Use terragrunt.hcl file
+
+
+If a terragrunt.hcl file with the terragrunt constrain is included in the current directory, it should automatically download or switch to that terragrunt version. For example, the following should automatically switch terragrunt to version 0.36.0:
+```ruby
+terragrunt_version_constraint = ">= 0.36, < 0.36.1"
+...
+```
+
+### Get the version from a subdirectory
+```bash
+tgswitch --chdir terragrunt_dir
+tgswitch -c terragrunt_dir
+```
+
+**Automatically switch with bash**
+
+Add the following to the end of your `~/.bashrc` file:
+(Use either `.tgswitchrc` or `.tgswitch.toml` or `.terragrunt-version`)
+
+```sh
+cdtgswitch(){
+ builtin cd "$@";
+ cdir=$PWD;
+ if [ -e "$cdir/.tgswitchrc" ]; then
+ tgswitch
+ fi
+}
+alias cd='cdtgswitch'
+```
+
+**Automatically switch with zsh**
+
+Add the following to the end of your `~/.zshrc` file:
+
+```sh
+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*
+```sh
+cd(){
+ builtin cd "$@";
+ cdir=$PWD;
+ if [ -e "$cdir/.tgswitchrc" ]; then
+ tgswitch
+ fi
+}
+```
+**Automatically switch with fish shell**
+
+Add the following to the end of your `~/.config/fish/config.fish` file:
+
+```sh
+function switch_terragrunt --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 tgswitch
+ end
+ end
+ end
+end
+```
diff --git a/www/docs/Troubleshoot.md b/www/docs/Troubleshoot.md
new file mode 100644
index 0000000..fd2fac7
--- /dev/null
+++ b/www/docs/Troubleshoot.md
@@ -0,0 +1,48 @@
+
+Problem:
+```sh
+install: can't change permissions of /usr/local/bin: Operation not permitted
+```
+
+```sh
+"Unable to remove symlink. You must have SUDO privileges"
+```
+
+```sh
+"Unable to create symlink. You must have SUDO privileges"
+```
+
+```sh
+install: cannot create regular file '/usr/local/bin/tgswitch': Permission denied
+```
+
+Solution: You probably need to have privileges to install *tgswitch* at /usr/local/bin.
+
+Try the following:
+
+```sh
+wget https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh #Get the installer on to your machine:
+
+chmod 755 install.sh #Make installer executable
+
+./install.sh -b $HOME/.bin #Install tgswitch in a location you have permission:
+
+$HOME/.bin/tgswitch #test
+
+export PATH=$PATH:$HOME/.bin #Export your .bin into your path
+
+#You should probably add step 4 in your `.bash_profile` in your $HOME directory.
+
+#Next, try:
+`tgswitch -b $HOME/.bin/terragrunt 0.38.0`
+
+#or simply
+
+`tgswitch -b $HOME/.bin/terragrunt`
+
+
+```
+
+See the custom directory option `-b`:
+
+
diff --git a/www/docs/Upgrade-or-Uninstall.md b/www/docs/Upgrade-or-Uninstall.md
new file mode 100644
index 0000000..201e31c
--- /dev/null
+++ b/www/docs/Upgrade-or-Uninstall.md
@@ -0,0 +1,29 @@
+## Upgrade:
+
+### Homebrew
+
+```ruby
+brew upgrade warrensbox/tap/tgswitch
+```
+### Linux
+
+Rerun:
+
+```sh
+curl -L https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh | bash
+```
+
+## Uninstall:
+
+### Homebrew
+
+```ruby
+brew uninstall warrensbox/tap/tgswitch
+```
+### Linux
+
+Run:
+
+```sh
+rm /usr/local/bin/tgswitch
+```
\ No newline at end of file
diff --git a/www/docs/index.md b/www/docs/index.md
new file mode 100644
index 0000000..bf94b59
--- /dev/null
+++ b/www/docs/index.md
@@ -0,0 +1,8 @@
+# What is tgswitch
+
+
+
+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.
\ No newline at end of file
diff --git a/www/mkdocs.yml b/www/mkdocs.yml
new file mode 100644
index 0000000..727fe30
--- /dev/null
+++ b/www/mkdocs.yml
@@ -0,0 +1,31 @@
+site_name: tgswitch
+site_description: A command line tool to switch between different versions of terragrunt (install with homebrew and more)
+copyright: This project is maintained by warrensbox
+repo_name: warrensbox/tgswitch
+repo_url: https://github.com/warrensbox/tgswitch
+site_url: https://tgswitch.warrensbox.com
+
+theme:
+ name: material
+ favicon: https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tgswitch/favicon_tgswitch_16.png
+ logo: https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tgswitch/logo.png
+ palette:
+ # - primary: light blue
+ # - accent: blue
+ # Palette toggle for light mode
+ - media: "(prefers-color-scheme: light)"
+ scheme: default
+ primary: light blue
+ accent: blue
+ toggle:
+ icon: material/brightness-7
+ name: Switch to dark mode
+
+ # Palette toggle for dark mode
+ - media: "(prefers-color-scheme: dark)"
+ scheme: slate
+ primary: light blue
+ accent: blue
+ toggle:
+ icon: material/brightness-4
+ name: Switch to light mode
\ No newline at end of file