From 580da2256945a30834f2a4991910b0be980e2c87 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Wed, 24 Jul 2019 16:53:15 +0800 Subject: [PATCH] Add basic bash-completion wrt #109 --- .bash-completion | 11 +++++++++++ ghcup | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 .bash-completion diff --git a/.bash-completion b/.bash-completion new file mode 100644 index 0000000..9df439b --- /dev/null +++ b/.bash-completion @@ -0,0 +1,11 @@ +_ghcup() +{ + local cur + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + if [[ ${#COMP_WORDS[*]} -le 2 ]]; then + COMPREPLY=($(compgen -W "$(ghcup --list-commands)" -- $cur)) + fi + return 0 +} && +complete -F _ghcup ghcup diff --git a/ghcup b/ghcup index 9086105..648e819 100755 --- a/ghcup +++ b/ghcup @@ -2049,6 +2049,18 @@ while [ $# -gt 0 ] ; do -V|--version) printf "%s\\n" "${VERSION}" exit 0;; + --list-commands) + echo "changelog +compile +debug-info +install +install-cabal +list +print-system-reqs +rm +set +upgrade" + exit 0;; -h|--help) usage;; -w|--wget)