File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash -e
2+
3+ __cppsm_complete () {
4+ local IFS=$' \t\n '
5+ COMPREPLY=()
6+ local PREVIOUS=" ${3# \" } "
7+ PREVIOUS=" ${PREVIOUS% \" } "
8+ local CURRENT=" ${2# \" } "
9+ CURRENT=" ${CURRENT% \" } "
10+ case " $PREVIOUS " in
11+ cppsm)
12+ # shellcheck disable=SC2207
13+ COMPREPLY=($( compgen -W " add build build-watch hello init list remove setup test test-watch update-all" -- " $CURRENT " ) )
14+ ;;
15+ add)
16+ # shellcheck disable=SC2207
17+ COMPREPLY=($( compgen -W " equipment requires" -- " $CURRENT " ) )
18+ ;;
19+ equipment|requires)
20+ if command -v jq > /dev/null && command -v curl > /dev/null && command -v sed > /dev/null; then
21+ # shellcheck disable=SC2207
22+ COMPREPLY=($( curl -s " https://api.github.com/search/repositories?q=topic:cppsm+${CURRENT##*/ } " | \
23+ jq ' .items | .[] | .clone_url' ) )
24+ fi
25+ ;;
26+ https:* .git)
27+ if command -v sed > /dev/null; then
28+ # shellcheck disable=SC2207
29+ COMPREPLY=($( git ls-remote --heads " $PREVIOUS " | sed -e ' s#[^ ]*\s*refs/heads/##g' ) )
30+ fi
31+ ;;
32+ * )
33+ ;;
34+ esac
35+ }
36+
37+ complete -F __cppsm_complete -o default cppsm
You can’t perform that action at this time.
0 commit comments