Skip to content

Commit

Permalink
Add bash completions for grimshot
Browse files Browse the repository at this point in the history
  • Loading branch information
em-s-h committed Mar 16, 2024
1 parent 6383df0 commit 7915870
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions grimshot-bash-completion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

_grimshot_bash_comp() {
local req_target="copy save savecopy"

# Complete options
if [[ ${COMP_WORDS[1]} =~ "-" && ${#COMP_WORDS[@]} -eq 2 ]]; then
COMPREPLY=( $(compgen -W "--notify --cursor --wait" -- "${COMP_WORDS[COMP_CWORD]}") )

# Complete commands
elif [[ ${#COMP_WORDS[@]} -eq 2 ]]; then
COMPREPLY=( $(compgen -W "check usage $req_target" -- "${COMP_WORDS[COMP_CWORD]}") )

# Complete targets
elif [[ $req_target =~ "${COMP_WORDS[1]}" && ${#COMP_WORDS[@]} -eq 3 ]]; then
COMPREPLY=( $(compgen -W "active screen output area window anything" -- "${COMP_WORDS[COMP_CWORD]}") )
fi
}

complete -F _grimshot_bash_comp grimshot

0 comments on commit 7915870

Please sign in to comment.