/zsh-sdkman

Zsh plugin to provide aliases and completion scripts for sdkman

Primary LanguageShellApache License 2.0Apache-2.0

Sdkman Zsh plugin

This sdkman plugin aims at making sdkman usage easier with completion scripts.

zsh-sdkman usage gif

Installation

zsh-sdkman is not bundled with ZSH, so you need to install it.

This plugin can be installed by adding antigen bundle matthieusb/zsh-sdkman to your .zshrc file. Antigen will handle cloning the plugin for you automatically the next time you start zsh. You can also add the plugin to a running ZSH session with antigen bundle matthieusb/zsh-sdkman for testing before adding it to your .zshrc.

This plugin can be installed by adding zgen load matthieusb/zsh-sdkman to your .zshrc file in the same function you're doing your other zgen load calls in. Zgen will automatically clone the repositories for you when you do a zgen save.

Go to your oh-my-zsh folder and then in custom/plugins and clone this repository:

git clone https://github.com/matthieusb/zsh-sdkman.git

And then, add to to your .zshrc plugin list like this:

plugins=(... zsh-sdkman)

note: cloning of zsh-sdkman requires the Git Large File Storage Git extension.

Dependencies

There are several packages that you'll need for this plugin to work:

  • sdkman of course
  • date
  • grep and egrep
  • sed
  • awk

Usage

First launch and completion update

On first launch, the script has to compute a few things in order to make the completion scripts work. It can take a while (I'd say five minutes tops) to be done so be patient. This operation is repeated every 12 hours automatically.

IMPORTANT: if you do new installations on your sdkman candidate or just play around with new versions, uninstallations or updates, DON'T FORGET to refresh the completion script files with the following command:

sdk-refresh-completion-files

Usage help

Sdkman can be used as usual:

Usage: sdk <command> [candidate] [version]
       sdk offline <enable|disable>

   commands:
       install   or i    <candidate> [version]
       uninstall or rm   <candidate> <version>
       list      or ls   [candidate]
       use       or u    <candidate> [version]
       default   or d    <candidate> [version]
       current   or c    [candidate]
       upgrade   or ug   [candidate]
       version   or v
       broadcast or b
       help      or h
       offline           [enable|disable]
       selfupdate        [force]
       update
       flush             <broadcast|archives|temp>

   candidate  :  the SDK to install: groovy, scala, grails, gradle, kotlin, etc.
                 use list command for comprehensive list of candidates
                 eg: $ sdk list

   version    :  where optional, defaults to latest stable if not provided
                 eg: $ sdk install groovy

Some aliases are available through this plugin:

Alias Command
sdki sdk install
sdkun sdk uninstall
list sdk list
sdku sdk use
sdkd sdk default
sdkc sdk current
sdkup sdk upgrade
sdkv sdk version
sdkb sdk broadcast
sdko sdk offline
sdksu sdk selfupdate
sdkf sdk flush