2021-01-23 14:15:22 +00:00
# dctlenv
2021-02-01 20:37:52 +00:00
![GitHub Workflow Status ](https://img.shields.io/github/workflow/status/wbeuil/dctlenv/Test%20Workflow )
2021-02-01 20:54:01 +00:00
[![All Contributors ](https://img.shields.io/badge/all_contributors-2-orange.svg )](#contributors-)
2021-01-23 14:15:22 +00:00
2021-12-14 13:31:57 +00:00
Version manager for [driftctl ](https://github.com/snyk/driftctl ) inspired by [tfenv ](https://github.com/tfutils/tfenv ).
2021-01-23 14:15:22 +00:00
## Installation
### Basic GitHub Checkout
This will get you going with the latest version of dctlenv and make it easy to fork and contribute any changes back upstream.
**1. Check out dctlenv where you want**
2021-01-25 17:18:35 +00:00
```console
2021-03-08 10:31:31 +00:00
# Install latest version
2021-01-23 14:15:22 +00:00
$ git clone https://github.com/wbeuil/dctlenv ~/.dctlenv
2021-03-08 10:31:31 +00:00
# Install a specific version (e.g. v0.1.2)
2021-03-08 10:35:45 +00:00
$ git clone --depth 1 --branch v0.1.2 https://github.com/wbeuil/dctlenv ~/.dctlenv
2021-01-23 14:15:22 +00:00
```
**2. Add `~/.dctlenv/bin` to your `$PATH` for access to the dctlenv CLI**
- For **Bash** :
2021-01-25 17:18:35 +00:00
```console
2021-01-23 14:15:22 +00:00
$ echo 'export PATH="$HOME/.dctlenv/bin:$PATH"' >> ~/.bash_profile
```
- For **Zsh** :
2021-01-25 17:18:35 +00:00
```console
2021-01-23 14:15:22 +00:00
$ echo 'export PATH="$HOME/.dctlenv/bin:$PATH"' >> ~/.zshrc
```
- For **Fish** :
2021-01-25 17:18:35 +00:00
```console
2021-01-23 14:15:22 +00:00
$ set -Ux fish_user_paths $HOME/.dctlenv/bin $fish_user_paths
```
**3. Restart your shell so that PATH changes take effect**
#### Upgrading With Git
If you've installed dctlenv using the instructions above, you can upgrade to the latest version by pulling from GitHub.
2021-01-25 17:18:35 +00:00
```console
2021-01-23 14:15:22 +00:00
$ cd ~/.dctlenv
$ git pull
```
2021-01-23 16:58:29 +00:00
## Command Reference
### `dctlenv install [<version>]`
Install a specific version of driftctl.
2021-03-05 17:32:51 +00:00
Available options:
2021-03-08 10:48:56 +00:00
- `(v)x.y.z` to install the exact version of driftctl
2021-03-05 17:32:51 +00:00
- `latest` to install the latest version of driftctl
2021-01-25 17:18:35 +00:00
```console
2021-01-23 16:58:29 +00:00
$ dctlenv install 0.2.3
Installing driftctl v0.2.3
2021-12-14 13:31:57 +00:00
Downloading release tarball from https://github.com/snyk/driftctl/releases/download/v0.2.3/driftctl_darwin_amd64
2021-01-23 16:58:29 +00:00
######################################################################################################################## 100.0%
2021-12-14 13:31:57 +00:00
Downloading SHA256 hashes file from https://github.com/snyk/driftctl/releases/download/v0.2.3/driftctl_SHA256SUMS
2021-02-12 18:18:56 +00:00
No SHA256 hashes file available. Skipping SHA256 hash validation
2021-01-23 16:58:29 +00:00
Installation of driftctl v0.2.3 successful. To make this your default version, run 'dctlenv use 0.2.3'
```
2021-12-17 13:51:54 +00:00
For signed version of driftctl (starting v0.10.0) you can now install and verify digital signature with dctlenv.
2021-02-12 18:18:56 +00:00
2021-12-17 13:51:54 +00:00
You just need to import the public key of CloudSkiff and have the gpg binary already installed.
2021-02-12 18:18:56 +00:00
```console
# Import key
2021-06-23 14:09:30 +00:00
$ gpg --keyserver hkps://keys.openpgp.org --recv-keys 0xACC776A79C824EBD
2021-02-12 18:18:56 +00:00
gpg: key ACC776A79C824EBD: public key "Cloudskiff < security @ cloudskiff . com > " imported
gpg: Total number processed: 1
gpg: imported: 1
# Install and verify signature
2021-12-17 13:51:54 +00:00
$ dctlenv install 0.10.0
Installing driftctl v0.10.0
Downloading release tarball from https://github.com/snyk/driftctl/releases/download/v0.10.0/driftctl_darwin_amd64
2021-02-12 18:18:56 +00:00
######################################################################################################################## 100.0%
2021-12-17 13:51:54 +00:00
Downloading SHA256 hashes file from https://github.com/snyk/driftctl/releases/download/v0.10.0/driftctl_SHA256SUMS
2021-02-12 18:18:56 +00:00
SHA256 hash matched!
2021-12-17 13:51:54 +00:00
Downloading SHA256 hashes signature file from https://github.com/snyk/driftctl/releases/download/v0.10.0/driftctl_SHA256SUMS.gpg
2021-02-12 18:18:56 +00:00
PGP signature matched!
2021-12-17 13:51:54 +00:00
Installation of driftctl v0.10.0 successful. To make this your default version, run 'dctlenv use 0.10.0'
2021-02-12 18:18:56 +00:00
```
2021-01-23 16:58:29 +00:00
### `dctlenv use [<version>]`
Switch a version to use.
2021-03-05 17:32:51 +00:00
Available options:
2021-03-08 10:48:56 +00:00
- `(v)x.y.z` to install and use the exact version of driftctl
2021-03-05 17:32:51 +00:00
- `latest` to install and use the latest version of driftctl
2021-01-25 17:18:35 +00:00
```console
2021-01-23 16:58:29 +00:00
$ dctlenv use 0.2.3
Switching version to v0.2.3
Switching completed
2021-03-08 10:48:56 +00:00
$ dctlenv use v0.6.0
Switching version to v0.6.0
Switching completed
2021-01-23 16:58:29 +00:00
```
### `dctlenv list`
List installed versions.
2021-01-25 17:18:35 +00:00
```console
2021-01-23 16:58:29 +00:00
$ dctlenv list
* 0.2.3 (set by /home/wbeuil/.dctlenv/version)
0.2.2
```
### `dctlenv list-remote`
List all installable versions.
2021-01-25 17:18:35 +00:00
```console
2021-01-23 16:58:29 +00:00
$ dctlenv list-remote
0.1.0
0.1.1
0.2.0
0.2.1
0.2.2
0.2.3
```
2021-01-25 14:36:44 +00:00
### `dctlenv uninstall [<version>]`
Uninstall a specific version of driftctl.
2021-03-08 10:48:56 +00:00
Available options:
- `(v)x.y.z` to uninstall the exact version of driftctl
2021-01-25 17:18:35 +00:00
```console
2021-01-25 14:36:44 +00:00
$ dctlenv uninstall 0.2.3
Uninstall driftctl v0.2.3
driftctl v0.2.3 is successfully uninstalled
2021-03-08 10:48:56 +00:00
$ dctlenv uninstall v0.6.0
Uninstall driftctl v0.6.0
driftctl v0.6.0 is successfully uninstalled
2021-01-25 14:36:44 +00:00
```
2021-01-23 16:58:29 +00:00
### `dctlenv root`
Display the root directory where dctlenv is.
2021-01-25 17:18:35 +00:00
```console
2021-01-23 16:58:29 +00:00
$ dctlenv root
/home/wbeuil/.dctlenv
```
### `dctlenv [version|-v|--version]`
Display dctlenv version.
2021-01-25 17:18:35 +00:00
```console
2021-01-23 16:58:29 +00:00
$ dctlenv version
dctlenv 0.0.2-1-gabff053
```
### `dctlenv [help|-h|--help]`
Display dctlenv help and usage contents.
2021-01-25 17:18:35 +00:00
```console
2021-01-23 16:58:29 +00:00
$ dctlenv help
Usage: dctlenv < command > [< options > ]
Commands:
install Install a specific version of driftctl
uninstall Uninstall a specific version of driftctl
use Switch a version to use
list List all installed versions
list-remote List all installable versions
version Display dctlenv version
help Show this help output
Flags:
-v, --version An alias for the "version" command
-h, --help An alias for the "help" command
For full documentation, see: https://github.com/wbeuil/dctlenv#readme
```
2021-01-23 14:15:22 +00:00
## Uninstalling dctlenv
2021-01-23 16:58:29 +00:00
You will need to first remove the line from your shell startup configuration file. This will remove dctlenv from your `$PATH` .
2021-01-23 14:15:22 +00:00
Then, you just need to remove its root directory:
2021-01-25 17:18:35 +00:00
```console
2021-01-23 14:15:22 +00:00
$ rm -rf `dctlenv root`
```
2021-01-25 22:39:27 +00:00
## Completion scripts
Completion scripts are available to use inside the `completions` folder.
### Bash
```console
# Linux:
2021-01-26 17:01:48 +00:00
$ sudo cp completions/dctlenv.bash /etc/bash_completion.d/dctlenv
2021-01-25 22:39:27 +00:00
# MacOS:
2021-01-26 17:01:48 +00:00
$ sudo cp completions/dctlenv.bash /usr/local/etc/bash_completion.d/dctlenv
2021-01-25 22:39:27 +00:00
```
Remember to open a new shell to test the functionality.
### Zsh
If shell completion is not already enabled in your environment, you will need to enable it. You can execute the following once:
```console
$ echo "autoload -U compinit; compinit" >> ~/.zshrc
```
Then, place the completion script in your completion folder listed in your `fpath` if it already exists. Otherwise, you can create a directory, add it to your `fpath` and copy the file in it:
```console
$ cp completions/dctlenv.zsh > fpath/completion_folder/_dctlenv
```
#### Oh-My-Zsh
```console
$ mkdir -p ~/.oh-my-zsh/completions
2021-01-26 17:01:48 +00:00
$ cp completions/dctlenv.zsh ~/.oh-my-zsh/completions/_dctlenv
2021-01-25 22:39:27 +00:00
```
You will need to start a new shell for this setup to take effect.
### Fish
```console
2021-01-26 17:01:48 +00:00
$ cp completions/dctlenv.fish ~/.config/fish/completions/dctlenv.fish
2021-01-25 22:39:27 +00:00
```
Remember to create the directory if it's not already there `mkdir -p ~/.config/fish/completions/` .
Remember to open a new shell to test the functionality.
2021-02-01 20:09:25 +00:00
## Environment variables
You can configure how `dctlenv` operates with the following settings:
| name | default | description |
| --------------- | ------- | ------------------------------------------------------------------------------------------- |
| `DCTLENV_ROOT` | | Defines the directory under which dctlenv resides< br > Current value shown by `dctlenv root` |
| `DCTLENV_ARCH` | `amd64` | Architecture other than the default amd64 can be specified |
| `DCTLENV_DEBUG` | `0` | Outputs debug information |
2021-04-14 21:06:12 +00:00
| `DCTLENV_CURL` | `0` | Curl download progress bar, 0 will run a -# curl and 1 will run a -s curl |
2021-02-01 20:30:38 +00:00
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL - CONTRIBUTORS - LIST:START - Do not remove or modify this section -->
<!-- prettier - ignore - start -->
<!-- markdownlint - disable -->
< table >
< tr >
< td align = "center" > < a href = "http://wbeuil.com" > < img src = "https://avatars.githubusercontent.com/u/8110579?v=4?s=100" width = "100px;" alt = "" / > < br / > < sub > < b > William BEUIL< / b > < / sub > < / a > < br / > < a href = "#ideas-wbeuil" title = "Ideas, Planning, & Feedback" > 🤔< / a > < a href = "https://github.com/wbeuil/dctlenv/commits?author=wbeuil" title = "Code" > 💻< / a > < a href = "https://github.com/wbeuil/dctlenv/commits?author=wbeuil" title = "Documentation" > 📖< / a > < a href = "#maintenance-wbeuil" title = "Maintenance" > 🚧< / a > < a href = "https://github.com/wbeuil/dctlenv/pulls?q=is%3Apr+reviewed-by%3Awbeuil" title = "Reviewed Pull Requests" > 👀< / a > < / td >
2021-02-01 20:38:52 +00:00
< td align = "center" > < a href = "https://github.com/sjourdan" > < img src = "https://avatars.githubusercontent.com/u/419121?v=4?s=100" width = "100px;" alt = "" / > < br / > < sub > < b > Stephane Jourdan< / b > < / sub > < / a > < br / > < a href = "https://github.com/wbeuil/dctlenv/commits?author=sjourdan" title = "Documentation" > 📖< / a > < / td >
2021-03-08 11:15:31 +00:00
< td align = "center" > < a href = "https://www.elie.ski" > < img src = "https://avatars.githubusercontent.com/u/6154987?v=4?s=100" width = "100px;" alt = "" / > < br / > < sub > < b > Elie< / b > < / sub > < / a > < br / > < a href = "https://github.com/wbeuil/dctlenv/commits?author=eliecharra" title = "Documentation" > 📖< / a > < / td >
2021-02-01 20:30:38 +00:00
< / tr >
< / table >
<!-- markdownlint - restore -->
<!-- prettier - ignore - end -->
<!-- ALL - CONTRIBUTORS - LIST:END -->
2021-02-01 20:37:52 +00:00
This project follows the [all-contributors ](https://github.com/all-contributors/all-contributors ) specification. Contributions of any kind welcome!