Last active
December 22, 2018 13:56
-
-
Save zereraz/2d25cd2c6b9f9bb06ac41a8ba2b74b0f to your computer and use it in GitHub Desktop.
todolist (todolist.site) autocomplete
This file contains hidden or 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
#!/bin/bash | |
_projects() { | |
local cur prev opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
opts=$(todolist list by p | cut -d ' ' -f 2 | grep -E "^[^\\[]+$" | sed -e 's/^/+/g') | |
if [[ ${cur} == +* ]] ; then | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
fi | |
} | |
complete -F _projects todolist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment