Skip to content

Commit

Permalink
Merge branch 'feature/unprivilege-user'
Browse files Browse the repository at this point in the history
  • Loading branch information
warrensbox committed Jun 10, 2019
2 parents 7e579a6 + a82b703 commit d03b39e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 192 deletions.
48 changes: 3 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The most recently selected versions are presented at the top of the dropdown.
3. Hit **Enter** to select the desired version.


### Use .tfswitch.toml file (For uprivilege users/ non-admin - users with limited privilege on their computer)
### 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

<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 170px;"/>
Expand All @@ -83,50 +83,6 @@ version = "0.11.3"

<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 170px;"/>

**Automatically switch with bash**

Add the following to the end of your `~/.bashrc` file:
```
cdtfswitch(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitch.toml" ]; then
tfswitch
fi
}
alias cd='cdtfswitch'
```

**Automatically switch with zsh**

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

```
load-tfswitch() {
local tfswitchrc_path=".tfswitch.toml"
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*
```
cd(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitchrc" ]; then
tfswitch
fi
}
```

### Use .tfswitchrc file
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v6.gif" alt="drawing" style="width: 170px;"/>
Expand All @@ -139,6 +95,8 @@ cd(){
**Automatically switch with bash**

Add the following to the end of your `~/.bashrc` file:
(Use either `.tfswitchrc` or `.tfswitch.toml`)

```
cdtfswitch(){
builtin cd "$@";
Expand Down
2 changes: 1 addition & 1 deletion docs/_site/additional.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{"description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->

<link rel="stylesheet" href="/assets/css/style.css?v=6d07d7f358b39ef797c837ef812a979456d32f5f">
<link rel="stylesheet" href="/assets/css/style.css?v=b5d2e9c5061f970064e2d889ea88fc4d54079084">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->
Expand Down
55 changes: 7 additions & 48 deletions docs/_site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{"name":"tfswitch","description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->

<link rel="stylesheet" href="/assets/css/style.css?v=6d07d7f358b39ef797c837ef812a979456d32f5f">
<link rel="stylesheet" href="/assets/css/style.css?v=b5d2e9c5061f970064e2d889ea88fc4d54079084">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->
Expand Down Expand Up @@ -128,10 +128,10 @@ <h3 id="see-all-versions-including-beta-alpha-and-release-candidatesrc">See all
<li>Hit <strong>Enter</strong> to select the desired version.</li>
</ol>

<h3 id="use-tfswitchtoml-file--for-uprivilege-users-non-admin---users-with-limited-privilege-on-their-computer">Use .tfswitch.toml file (For uprivilege users/ non-admin - users with limited privilege on their computer)</h3>
<h3 id="use-tfswitchtoml-file--for-non-admin---users-with-limited-privilege-on-their-computers">Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers)</h3>
<p>This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation</p>

<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 170px;" /></p>
<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 490px;" /></p>

<ol>
<li>Create a custom binary path. Ex: <code class="highlighter-rouge">mkdir /Users/warrenveerasingam/bin</code> (replace warrenveerasingam with your username)</li>
Expand All @@ -146,50 +146,7 @@ <h3 id="use-tfswitchtoml-file--for-uprivilege-users-non-admin---users-with-limit
<li>Run <code class="highlighter-rouge">tfswitch</code> and it should automatically install the required terraform version in the specified binary path</li>
</ol>

<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 170px;" /></p>

<p><strong>Automatically switch with bash</strong></p>

<p>Add the following to the end of your <code class="highlighter-rouge">~/.bashrc</code> file:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cdtfswitch(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitch.toml" ]; then
tfswitch
fi
}
alias cd='cdtfswitch'
</code></pre></div></div>

<p><strong>Automatically switch with zsh</strong></p>

<p>Add the following to the end of your <code class="highlighter-rouge">~/.zshrc</code> file:</p>

<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>load-tfswitch() {
local tfswitchrc_path=".tfswitch.toml"

if [ -f "$tfswitchrc_path" ]; then
tfswitch
fi
}
add-zsh-hook chpwd load-tfswitch
load-tfswitch
</code></pre></div></div>
<blockquote>
<p>NOTE: if you see an error like this: <code class="highlighter-rouge">command not found: add-zsh-hook</code>, then you might be on an older version of zsh (see below), or you simply need to load <code class="highlighter-rouge">add-zsh-hook</code> by adding this to your <code class="highlighter-rouge">.zshrc</code>:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> autoload -U add-zsh-hook
</code></pre></div> </div>
</blockquote>

<p><em>older version of zsh</em></p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cd(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitchrc" ]; then
tfswitch
fi
}
</code></pre></div></div>
<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 490px;" /></p>

<h3 id="use-tfswitchrc-file">Use .tfswitchrc file</h3>
<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v6.gif" alt="drawing" style="width: 490px;" /></p>
Expand All @@ -202,7 +159,9 @@ <h3 id="use-tfswitchrc-file">Use .tfswitchrc file</h3>

<p><strong>Automatically switch with bash</strong></p>

<p>Add the following to the end of your <code class="highlighter-rouge">~/.bashrc</code> file:</p>
<p>Add the following to the end of your <code class="highlighter-rouge">~/.bashrc</code> file:
(Use either <code class="highlighter-rouge">.tfswitchrc</code> or <code class="highlighter-rouge">.tfswitch.toml</code>)</p>

<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cdtfswitch(){
builtin cd "$@";
cdir=$PWD;
Expand Down
55 changes: 6 additions & 49 deletions docs/_site/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ The most recently selected versions are presented at the top of the dropdown.
2. For example, `tfswitch -l` or `tfswitch --list-all` to see all versions.
3. Hit **Enter** to select the desired version.

### Use .tfswitch.toml file (For uprivilege users/ non-admin - users with limited privilege on their computer)
### 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

<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 170px;"/>
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 490px;"/>

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)
Expand All @@ -74,52 +74,7 @@ version = "0.11.3"
```
4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path

<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 170px;"/>

**Automatically switch with bash**

Add the following to the end of your `~/.bashrc` file:
```
cdtfswitch(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitch.toml" ]; then
tfswitch
fi
}
alias cd='cdtfswitch'
```

**Automatically switch with zsh**

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

```
load-tfswitch() {
local tfswitchrc_path=".tfswitch.toml"
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*
```
cd(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitchrc" ]; then
tfswitch
fi
}
```
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 490px;"/>

### Use .tfswitchrc file
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v6.gif" alt="drawing" style="width: 490px;"/>
Expand All @@ -131,7 +86,9 @@ cd(){

**Automatically switch with bash**

Add the following to the end of your `~/.bashrc` file:
Add the following to the end of your `~/.bashrc` file:
(Use either `.tfswitchrc` or `.tfswitch.toml`)

```
cdtfswitch(){
builtin cd "$@";
Expand Down
55 changes: 6 additions & 49 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ The most recently selected versions are presented at the top of the dropdown.
2. For example, `tfswitch -l` or `tfswitch --list-all` to see all versions.
3. Hit **Enter** to select the desired version.

### Use .tfswitch.toml file (For uprivilege users/ non-admin - users with limited privilege on their computer)
### 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

<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 170px;"/>
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 490px;"/>

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)
Expand All @@ -74,52 +74,7 @@ version = "0.11.3"
```
4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path

<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 170px;"/>

**Automatically switch with bash**

Add the following to the end of your `~/.bashrc` file:
```
cdtfswitch(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitch.toml" ]; then
tfswitch
fi
}
alias cd='cdtfswitch'
```

**Automatically switch with zsh**

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

```
load-tfswitch() {
local tfswitchrc_path=".tfswitch.toml"
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*
```
cd(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitchrc" ]; then
tfswitch
fi
}
```
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 490px;"/>

### Use .tfswitchrc file
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v6.gif" alt="drawing" style="width: 490px;"/>
Expand All @@ -131,7 +86,9 @@ cd(){

**Automatically switch with bash**

Add the following to the end of your `~/.bashrc` file:
Add the following to the end of your `~/.bashrc` file:
(Use either `.tfswitchrc` or `.tfswitch.toml`)

```
cdtfswitch(){
builtin cd "$@";
Expand Down

0 comments on commit d03b39e

Please sign in to comment.