Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
!README.md
!sce.bat
!sce.sh
!sce_completion.sh
1 change: 1 addition & 0 deletions sce.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ then
# For other shells (Bash, Zsh, etc.)
echo "# for the sce dev tool"
echo "alias sce=\"$(pwd)/sce.sh\""
echo "source \"$(pwd)/sce_completion.sh\""
echo ""
exit 0
fi
Expand Down
23 changes: 23 additions & 0 deletions sce_completion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

_sce_completion() {
local cur prev opts repos
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="clone run link setup completion"
repos="Clark cleezy Quasar SCE-discord-bot SCEta"

if [[ ${prev} == "clone" || ${prev} == "run" || ${prev} == "link" ]]; then
COMPREPLY=( $(compgen -W "${repos}" -- ${cur}) )
else
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
fi

if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
COMPREPLY=( $(compgen -o default -- ${cur}) )
fi

return 0
}
complete -F _sce_completion sce