Created
February 22, 2024 11:38
-
-
Save uyriq/e715172601df79b0726409748549485b to your computer and use it in GitHub Desktop.
part of ,bashrc for tea command tunning. How to add --repo "reponame" automaticaly postfix based on current repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# work but badly way | |
gitea() { | |
reponame="basename -s .git $(git config --get remote.origin.url)" | |
giteaargs="$@" | |
tea $giteaargs --repo $reponame | |
} | |
PROG2=gitea | |
_cli_bash_autocomplete() { | |
if [[ "${COMP_WORDS[0]}" != "source" ]]; then | |
local cur opts base | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
if [[ "$cur" == "-"* ]]; then | |
opts=$(${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion) | |
else | |
opts=$(${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion) | |
fi | |
COMPREPLY=($(compgen -W "${opts}" -- ${cur})) | |
return 0 | |
fi | |
} | |
complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete $PROG2 | |
unset PROG2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment