diff --git a/details.md b/details.md index a08272f..45eab8b 100755 --- a/details.md +++ b/details.md @@ -74,9 +74,9 @@ $ git checkout main You might not need all the things that cli-config installs. To see the list of tools available pass the `--help` switch. You can pass the list of tools to install with the `-t` or `--tools` switch, like so ```bash -$ ./cli-config install --tools antigen,nvm,ohmyposh +$ ./cli-config install --tools zimfw,asdf,ohmyposh ``` 3. Run the setup again -After thinking about it, I've decided that cli-config should retain the older installation even if you run `./cli-config` multiple times. So, incase you want to reinstall any tool, you can delete that folder or the entire `current` folder before running setup again. (Example: If you want to reinstall nvm, delete the `current/nvm` folder and run `cli-config` again) +After thinking about it, I've decided that cli-config should retain the older installation even if you run `./cli-config` multiple times. So, incase you want to reinstall any tool, you can delete that folder or the entire `current` folder before running setup again. (Example: If you want to reinstall asdf, delete the `current/asdf` folder and run `cli-config` again) diff --git a/profiles/mrsauravsahu/.zshrc b/profiles/mrsauravsahu/.zshrc index 86c129e..44683fe 100755 --- a/profiles/mrsauravsahu/.zshrc +++ b/profiles/mrsauravsahu/.zshrc @@ -1,4 +1,3 @@ -ANTIGEN_LOG=false # vim: set filetype=zsh : # zmodload zsh/zprof HOMEBREW_NO_AUTO_UPDATE=1 diff --git a/readme.md b/readme.md old mode 100755 new mode 100644 index 861e902..0963e1b --- a/readme.md +++ b/readme.md @@ -73,13 +73,9 @@ Once the setup is done, your `~/.zshrc` will be symlinked to the [default profil ### Basics - [ohmyzsh](https://github.com/ohmyzsh/ohmyzsh) for zsh plugins - [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh) for prompt customization and theming -- [antigen](https://github.com/zsh-users/antigen) for more plugins 😉 ### Programming Support -- [nvm](https://github.com/nvm-sh/nvm) for managing multiple node versions -- [pyenv](https://github.com/pyenv/pyenv) for multiple python versions -- [dotnet](https://github.com/dotnet/core) -- [tfenv](https://github.com/tfutils/tfenv) manage multiple terraform versions +- [asdf](https://github.com/asdf-vm/asdf) single version manager for every runtime (node, python, go, dotnet, terraform, ...) via plugins ### Helpers and Goodies - [direnv](https://github.com/direnv/direnv) @@ -94,13 +90,12 @@ Once the setup is done, your `~/.zshrc` will be symlinked to the [default profil ## What's new? 🎉 -- Manage multiple terraform version with [tfenv](https://github.com/tfutils/tfenv). +- Runtime versions are managed solely by [asdf](https://github.com/asdf-vm/asdf) - the nvm, pyenv, gvm, tfenv and dotnet installers have been removed. - Theming & Prompt customization support with [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh). - Fresh new installation experience, powered by [Bash oo Framework](https://github.com/niieani/bash-oo-framework). -- Switch antigen themes with a single env variable `CLI_CONFIG_THEME` +- Switch oh-my-posh themes with a single env variable `CLI_CONFIG_THEME` - Extra tools available for Linux as well! Check out the [package list](extras/apt-list.txt). - New extras package - [tmux](https://github.com/tmux/tmux/wiki) - Setup apps and cool goodies on macOS with brew. Checkout the [extras](extras/setup.sh) script. -- Support for .nvmrc - set node version for a particular directory! \-S diff --git a/src/defs/configure.zsh b/src/defs/configure.zsh index 7114275..fa57f4c 100755 --- a/src/defs/configure.zsh +++ b/src/defs/configure.zsh @@ -12,7 +12,7 @@ configure() { # load cli-config env variables . ${CLI_CONFIG_ROOT}/src/scripts/env.zsh - programs=('asdf' 'zimfw' 'ohmyzsh' 'ohmyposh' 'nvm' 'pyenv' 'dotnet' 'tfenv' 'gvm' 'zsh-plugins') + programs=('asdf' 'zimfw' 'ohmyzsh' 'ohmyposh' 'zsh-plugins') for item in ${programs[@]}; do Log "Updating configuration for cli-config/${item}" if [ -d "${CLI_CONFIG_ROOT}/current/${item}" ]; then diff --git a/src/defs/usage.zsh b/src/defs/usage.zsh index ab14c76..3d0b3da 100755 --- a/src/defs/usage.zsh +++ b/src/defs/usage.zsh @@ -1,38 +1,19 @@ #!/usr/bin/env bash . ${CLI_CONFIG_ROOT}/src/utils/array.zsh -. ${CLI_CONFIG_ROOT}/src/utils/tool-guards.zsh usage() { modes=('install' 'configure' 'uninstall') profiles=($(ls -1 "${CLI_CONFIG_ROOT}/profiles")) - all_tools=$(ls -1 $CLI_CONFIG_ROOT/src/installers | sed 's/\..*$//g' | sort | uniq) - active_tools=() - deprecated_tools_found=() - - while IFS= read -r tool; do - local is_deprecated=false - for d in "${DEPRECATED_TOOLS[@]}"; do - [[ "$tool" == "$d" ]] && is_deprecated=true && break - done - if $is_deprecated; then - deprecated_tools_found+=("$tool") - else - active_tools+=("$tool") - fi - done <<<"$all_tools" + tools=($(ls -1 $CLI_CONFIG_ROOT/src/installers | sed 's/\..*$//g' | sort | uniq)) modes_str=$(array_str ", " "${modes[@]}") profiles_str=$(array_str "/" "${profiles[@]}") - active_tools_str=$(array_str "," "${active_tools[@]}") - deprecated_tools_str=$(array_str "," "${deprecated_tools_found[@]}") - plugin_managers_str=$(array_str "/" "${PLUGIN_MANAGERS[@]}") + tools_str=$(array_str "," "${tools[@]}") echo "cli-config [-p|--profile=profileName] [-t|--tools=tool1,tool2]" printf "\n" echo "mode: ${modes_str} " echo "profile: ${profiles_str} " - printf "tools: ${active_tools_str}\n" - printf " plugin manager (choose one, default: ${PLUGIN_MANAGER_DEFAULT}): ${plugin_managers_str}\n" - printf " deprecated (use ${DEPRECATED_TOOLS_REPLACEMENT} instead): ${deprecated_tools_str}\n" + printf "tools: ${tools_str}\n" } diff --git a/src/extras/nvmrc-support.zsh b/src/extras/nvmrc-support.zsh deleted file mode 100755 index f884d4a..0000000 --- a/src/extras/nvmrc-support.zsh +++ /dev/null @@ -1,21 +0,0 @@ -# .nvmrc support -autoload -U add-zsh-hook -load-nvmrc() { - local node_version="$(nvm version)" - local nvmrc_path="$(nvm_find_nvmrc)" - - if [ -n "$nvmrc_path" ]; then - local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") - - if [ "$nvmrc_node_version" = "N/A" ]; then - nvm install - elif [ "$nvmrc_node_version" != "$node_version" ]; then - nvm use - fi - elif [ "$node_version" != "$(nvm version default)" ]; then - echo "Reverting to nvm default version" - nvm use default - fi -} -add-zsh-hook chpwd load-nvmrc -load-nvmrc diff --git a/src/installers/dotnet.configure.zsh b/src/installers/dotnet.configure.zsh deleted file mode 100755 index b49add6..0000000 --- a/src/installers/dotnet.configure.zsh +++ /dev/null @@ -1,6 +0,0 @@ -TOOL=dotnet -CONF=$CLI_CONFIG_CONF_LOCATION/$TOOL.conf.sh - -echo -n >$CONF -printf 'export DOTNET_ROOT="$CLI_CONFIG_ROOT/current/dotnet"\n' >>$CONF -printf 'export PATH="$CLI_CONFIG_ROOT/current/dotnet:$PATH"\n' >>$CONF diff --git a/src/installers/dotnet.install.zsh b/src/installers/dotnet.install.zsh deleted file mode 100755 index 938d2e3..0000000 --- a/src/installers/dotnet.install.zsh +++ /dev/null @@ -1,11 +0,0 @@ -if [ -d "$CLI_CONFIG_ROOT/current/dotnet" ]; then - Log 'Seems cli-config/dotnet is already installed!' -else - Log "Installing dotnet" - - mkdir $CLI_CONFIG_ROOT/current/dotnet - - dotnetInstallerLocation=$CLI_CONFIG_TOOLS_LOCATION/dotnet-install.sh - wget -O $dotnetInstallerLocation https://dot.net/v1/dotnet-install.sh - bash $dotnetInstallerLocation --install-dir $CLI_CONFIG_ROOT/current/dotnet --channel STS -fi diff --git a/src/installers/gvm.configure.zsh b/src/installers/gvm.configure.zsh deleted file mode 100755 index 7421a1b..0000000 --- a/src/installers/gvm.configure.zsh +++ /dev/null @@ -1,10 +0,0 @@ -export GOROOT="${CLI_CONFIG_ROOT}/current/gvm" -TOOL=gvm -CONF=$CLI_CONFIG_CONF_LOCATION/$TOOL.conf.sh -DEFAULT_GO_VERSION=go1.17.7 - -echo -n >$CONF -printf 'export GVM_DIR="$CLI_CONFIG_ROOT/current/gvm"\n' >>$CONF -printf "# add gvm to path\n" >>$CONF -printf 'export PATH="$GVM_DIR:$PATH"\n' >>$CONF -printf 'lazyload gvm -- "source $GVM_DIR/scripts/gvm"' >>$CONF diff --git a/src/installers/gvm.install.zsh b/src/installers/gvm.install.zsh deleted file mode 100755 index c5a2608..0000000 --- a/src/installers/gvm.install.zsh +++ /dev/null @@ -1,32 +0,0 @@ -export GOROOT="${CLI_CONFIG_ROOT}/current/gvm" -TOOL=gvm -CONF=$CLI_CONFIG_CONF_LOCATION/$TOOL.conf.sh -DEFAULT_GO_VERSION=go1.17.7 - -if [ -d "$CLI_CONFIG_ROOT/current/$TOOL" ]; then - Log 'Seems cli-config/gvm is already installed!' -else - Log "Installing gvm" - - curl -sSL https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer | zsh -s -- master "$CLI_CONFIG_ROOT/current" - - currentOs=$(uname -s) - if [ $currentOs = "Linux" ]; then - # TODO: check if we are specifically on Ubuntu - Log "Setting up dependencies for gvm" - cmd="$CCOPT_DEBIAN_FRONTEND $CCOPT_NO_SUDO apt install --yes --no-install-recommends curl git mercurial make binutils bison gcc build-essential" - Log "$cmd" - eval $cmd - elif [ $currentOs = "Darwin" ]; then - cmd="brew install mercurial" - Log "$cmd" - eval $cmd - fi - - Log "Installing $DEFAULT_GO_VERSION with gvm" - export GVM_DIR="$CLI_CONFIG_ROOT/current/gvm" - . $GOROOT/scripts/gvm - gvm install $DEFAULT_GO_VERSION -B - Log "Setting up $DEFAULT_GO_VERSION to be used globally" - gvm use $DEFAULT_GO_VERSION --default -fi diff --git a/src/installers/nvm.configure.zsh b/src/installers/nvm.configure.zsh deleted file mode 100755 index acc721d..0000000 --- a/src/installers/nvm.configure.zsh +++ /dev/null @@ -1,9 +0,0 @@ -TOOL=nvm -CONF=$CLI_CONFIG_CONF_LOCATION/$TOOL.conf.sh - -echo -n >$CONF -printf 'export NVM_DIR="$CLI_CONFIG_ROOT/current/nvm"\n' >>$CONF -printf "# add nvm to path\n" >>$CONF -printf 'export PATH="$NVM_DIR:$PATH"\n' >>$CONF -# printf 'lazyload nvm node npm -- "source $NVM_DIR/nvm.sh"' >>$CONF -# turn off lazyload until I figure out how to let it work with AI agents diff --git a/src/installers/nvm.install.zsh b/src/installers/nvm.install.zsh deleted file mode 100755 index e5cc258..0000000 --- a/src/installers/nvm.install.zsh +++ /dev/null @@ -1,16 +0,0 @@ -TOOL=nvm -CONF=$CLI_CONFIG_CONF_LOCATION/$TOOL.conf.sh - -if [ -d "$CLI_CONFIG_ROOT/current/nvm" ]; then - Log 'Seems cli-config/nvm is already installed!' -else - Log "Installing nvm" - Log "Installing node.js with nvm" - - NVM_DIR=$CLI_CONFIG_ROOT/current/nvm - mkdir $NVM_DIR - wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | PROFILE=/dev/null NVM_DIR=$CLI_CONFIG_ROOT/current/nvm bash - - . $NVM_DIR/nvm.sh - nvm install --lts -fi diff --git a/src/installers/pyenv.configure.zsh b/src/installers/pyenv.configure.zsh deleted file mode 100755 index 69d12d7..0000000 --- a/src/installers/pyenv.configure.zsh +++ /dev/null @@ -1,8 +0,0 @@ -TOOL=pyenv -CONF=$CLI_CONFIG_CONF_LOCATION/$TOOL.conf.sh - -echo -n >$CONF -printf "export PYENV_ROOT="$CLI_CONFIG_ROOT/current/pyenv"\n" >>$CONF -printf "export PATH="\$PYENV_ROOT/bin:\$PYENV_ROOT/shims:\$PATH"\n" >>$CONF -printf "eval \"\$(pyenv init -)\"\n" >>$CONF -printf "eval \"\$(pyenv virtualenv-init -)\"\n" >>$CONF diff --git a/src/installers/pyenv.install.zsh b/src/installers/pyenv.install.zsh deleted file mode 100755 index 5004522..0000000 --- a/src/installers/pyenv.install.zsh +++ /dev/null @@ -1,31 +0,0 @@ -DEFAULT_PYTHON_VERSION=3.10.2 - -if [ -d "$CLI_CONFIG_ROOT/current/pyenv" ]; then - Log 'Seems cli-config/pyenv is already installed!' -else - - Log "Installing pyenv" - - CLI_CONFIG_PYENV_ROOT=$CLI_CONFIG_ROOT/current/pyenv - - git clone --depth=1 https://github.com/pyenv/pyenv.git $CLI_CONFIG_PYENV_ROOT - - currentOs=$(uname -s) - if [ $currentOs = "Linux" ]; then - # TODO: check if we are specifically on Ubuntu - Log "Setting up dependencies for pyenv" - cmd="$CCOPT_DEBIAN_FRONTEND $CCOPT_NO_SUDO apt install --yes --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev" - Log "$cmd" - eval $cmd - elif [ $currentOs = "Darwin" ]; then - Log 'No macOS specific customization need for pyenv' - fi - - Log "Installing pyenv virtualenv" - git clone https://github.com/pyenv/pyenv-virtualenv.git $CLI_CONFIG_ROOT/current/pyenv/plugins/pyenv-virtualenv - - Log "Installing python-$DEFAULT_PYTHON_VERSION with pyenv" - $CLI_CONFIG_PYENV_ROOT/bin/pyenv install $DEFAULT_PYTHON_VERSION - Log "Installing python-$DEFAULT_PYTHON_VERSION to be used globally" - $CLI_CONFIG_PYENV_ROOT/bin/pyenv global $DEFAULT_PYTHON_VERSION -fi diff --git a/src/installers/tfenv.configure.zsh b/src/installers/tfenv.configure.zsh deleted file mode 100755 index f798e4a..0000000 --- a/src/installers/tfenv.configure.zsh +++ /dev/null @@ -1,6 +0,0 @@ -TOOL=tfenv -CONF=$CLI_CONFIG_CONF_LOCATION/$TOOL.conf.sh - -echo -n >$CONF -printf "export TFENV_ROOT="$CLI_CONFIG_ROOT/current/tfenv"\n" >>$CONF -printf "export PATH="\$TFENV_ROOT/bin:\$PATH"\n" >>$CONF diff --git a/src/installers/tfenv.install.zsh b/src/installers/tfenv.install.zsh deleted file mode 100755 index bf308b6..0000000 --- a/src/installers/tfenv.install.zsh +++ /dev/null @@ -1,10 +0,0 @@ -if [ -d "$CLI_CONFIG_ROOT/current/tfenv" ]; then - Log 'Seems cli-config/tfenv is already installed!' -else - - Log "Installing tfenv" - - CLI_CONFIG_TFENV_ROOT=$CLI_CONFIG_ROOT/current/tfenv - - git clone --depth=1 https://github.com/tfutils/tfenv.git $CLI_CONFIG_TFENV_ROOT -fi diff --git a/src/utils/read-options.zsh b/src/utils/read-options.zsh index df5f357..27d6b41 100755 --- a/src/utils/read-options.zsh +++ b/src/utils/read-options.zsh @@ -1,11 +1,10 @@ read_options() { - . $CLI_CONFIG_ROOT/src/utils/tool-guards.zsh # DEFAULT OPTIONS CCOPT_PROFILE=default CCOPT_NO_SUDO='sudo' CCOPT_DEBIAN_FRONTEND='' - CCOPT_TOOLS=('zimfw' 'ohmyposh' 'asdf' 'dotnet') + CCOPT_TOOLS=('zimfw' 'ohmyposh' 'asdf') # READ OPTIONS # Todo: Move to separate file @@ -55,7 +54,6 @@ read_options() { exit fi - validate_tools "${CCOPT_TOOLS[@]}" shift shift ;; diff --git a/src/utils/tool-guards.zsh b/src/utils/tool-guards.zsh deleted file mode 100644 index 364006e..0000000 --- a/src/utils/tool-guards.zsh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env zsh - -PLUGIN_MANAGERS=('zimfw' 'antigen') -PLUGIN_MANAGER_DEFAULT='zimfw' -DEPRECATED_TOOLS=('tfenv' 'pyenv' 'nvm' 'gvm') -DEPRECATED_TOOLS_REPLACEMENT='asdf' - -validate_tools() { - local tools=("$@") - local plugin_manager_count=0 - local errors=() - - for tool in "${tools[@]}"; do - # deprecation check - for deprecated in "${DEPRECATED_TOOLS[@]}"; do - if [[ "$tool" == "$deprecated" ]]; then - echo "[cli-config] Warning: '$tool' is deprecated — use '$DEPRECATED_TOOLS_REPLACEMENT' instead." - fi - done - - # count how many plugin managers were requested - for pm in "${PLUGIN_MANAGERS[@]}"; do - if [[ "$tool" == "$pm" ]]; then - ((plugin_manager_count++)) - fi - done - done - - if ((plugin_manager_count > 1)); then - pm_list=$(printf '%s, ' "${PLUGIN_MANAGERS[@]}") - pm_list=${pm_list%, } - echo "[cli-config] Error: only one plugin manager can be specified ($pm_list). Got $plugin_manager_count." - exit 1 - fi -}