sdkman / sdkman-cli

The SDKMAN! Command Line Interface
https://sdkman.io
Apache License 2.0
6.05k stars 628 forks source link

Add tab completion/auto complete #83

Open OmidTahouri opened 11 years ago

OmidTahouri commented 11 years ago

It would be great if I could tab to complete my command.

Especially handy when it gets to providing a version. You'd be able to see available versions as you're typing (saves you from doing a gvm list <candidate>).

yerinle commented 11 years ago

Hi,

I have included tab completion to zsh through oh-my-zsh.

If you happen to use zsh and oh-my-zsh then you can get auto-completion by following the steps below.

  1. create a new gvm folder in the plugins folder
  2. create a file named "_gvm"
  3. Add the content of the commit below in the _gvm file.

https://github.com/yerinle/oh-my-zsh/commit/74526e64dc57ffdfa264319c59ffd502de6fc014

  1. Start a new shell and you will now have tab completion.

I have sent a pull request to the maintainer and I hope it gets included soon, which will make installation a breeze.

marc0der commented 11 years ago

Excellent! Thank you!

yerinle commented 11 years ago

You are welcome.

What are you thoughts on including description of each commands with the tool? For example, executing "gvm help --info" and then you get the list below

broadcast -- display the last broadcast message current -- dispaly current candidate version default -- set the default candidate version for every shell help -- show the gvm help message install -- install a candidate version list -- list available candidate versions selfupdate -- update the gvm uninstall -- uninstall a candidate version use -- use a candidate version in current shell version -- display the current version of gvm

This is what I currently present in zsh but it will be good for this to be in a central place and not be repeated/duplicated for each shell (e.g bash). That way all users will have a similar experience and we keep it DRY.

Thanks.

marc0der commented 11 years ago

Issue #45 is about improving the help command to be more descriptive. Moving this discussion to that issue.

markhu commented 6 years ago

try this: https://github.com/Bash-it/bash-it/blob/master/completion/available/sdkman.completion.bash

rahulsom commented 6 years ago

For Oh-My-Zsh, please check out https://github.com/robbyrussell/oh-my-zsh/pull/6483

reitzig commented 6 years ago

For fish: https://github.com/reitzig/sdkman-for-fish