ocenv

command
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

README

Static Tests Int Test Linux Int Test MacOS Int Test Windows

ocenv

OC version manager inspired by tfenv.

Features

  • Install OC versions in a reproducible and easy way
  • Enforce version in your git repositories with a .oc_version file

Supported OS

Currently ocenv supports the following OSes

  • Mac OS
  • Linux
  • Windows

Installation

There are two components in ocenv. One is the ocenv binary, the other one is a oc wrapper. It works as if were oc, but it has some logic to choose the version to execute. You should take care and ensure that you don't have any oc binary in your path. To check which binary you're executing, you can see it with:

$ which oc
/opt/brew/bin/oc
Homebrew

This is the recomended way, since it provides upgrades. It should work in Mac, Linux and Windows with WSL.

# Just the first time, activate the repository
brew tap little-angry-clouds/homebrew-my-brews
# To install
brew install ocenv
# To upgrade
brew upgrade ocenv

You should add your homebrew binary path to your PATH:

echo 'export PATH="$(brew --prefix)/bin/:$PATH"' >> ~/.bashrc
# Or
echo 'export PATH="$(brew --prefix)/bin/:$PATH"' >> ~/.zshrc

For Windows you should do the weird stuff that it needs to set an environmental variable.

Manually
  1. Add ~/.bin to your $PATH and create it if doesn't exist
echo 'export PATH="$HOME/.bin:$PATH"' >> ~/.bashrc
# Or
echo 'export PATH="$HOME/.bin:$PATH"' >> ~/.zshrc

mkdir -p ~/.bin
  1. Download the binaries and put them on your path

Go to the releases page and download the version you want. For example:

wget https://github.com/little-angry-clouds/kubernetes-binaries-managers/releases/download/0.0.4/ocenv-linux-amd64.tar.gz
tar xzf ocenv-linux-amd64.tar.gz
mv ocenv-linux-amd64 ~/.bin/ocenv
mv oc-wrapper-linux-amd64 ~/.bin/oc

And that's it!

Usage

Help
$ ocenv help
Oc version manager

Usage:
  ocenv [command]

Available Commands:
  help        Help about any command
  install     Install binary
  list        Lists local and remote versions
  uninstall   Uninstall binary
  use         Set the default version to use

Flags:
  -h, --help     help

Use "ocenv [command] --help" for more information about a command.
List installable versions

This option uses Github API to paginate all versions. Github API has some usage limitations. It usually works, but if you happen to do a lot of requests to github or are on an office or similar, chances are that this command will fail. You can still install binaries if you know the version you want, thought.

$ ocenv list remote
4.7.0-0.okd-2021-07-03-190901
4.7.0-0.okd-2021-06-19-191547
4.7.0-0.okd-2021-06-13-090745
4.7.0-0.okd-2021-06-04-191031
4.7.0-0.okd-2021-05-22-050008
4.7.0-0.okd-2021-04-24-103438
4.7.0-0.okd-2021-04-11-124433
...
List installed versions
$ ocenv list local
4.7.0-0.okd-2021-07-03-190901
4.7.0-0.okd-2021-06-19-191547
4.7.0-0.okd-2021-06-13-090745
4.7.0-0.okd-2021-06-04-191031
4.7.0-0.okd-2021-05-22-050008
4.7.0-0.okd-2021-04-24-103438
4.7.0-0.okd-2021-04-11-124433
Install version
$ ocenv install 4.7.0-0.okd-2021-07-03-190901
Downloading binary...
Done! Saving it at /home/user/.bin/oc-4.7.0-0.okd-2021-07-03-190901
Use version
$ ocenv use 4.7.0-0.okd-2021-07-03-190901
Done! Using 4.7.0-0.okd-2021-07-03-190901 version.
Uninstall version
$ ocenv uninstall 4.7.0-0.okd-2021-07-03-190901
Done! 4.7.0-0.okd-2021-07-03-190901 version uninstalled from /home/ap/.bin/oc-4.7.0-0.okd-2021-07-03-190901.

License

GPL3

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL