diff options
author | Aditya <bluenerd@protonmail.com> | 2023-02-27 20:04:56 +0530 |
---|---|---|
committer | Aditya <bluenerd@protonmail.com> | 2023-02-27 20:04:56 +0530 |
commit | edc449275b6c04445f58b108ca0937a87c1e8430 (patch) | |
tree | 9fd484d58145b616f29a78857cc0b1c8b1c18f05 /oh-my-zsh/plugins/paver | |
parent | 6f5424ca96c4221ef433f545642669e9c104d0ed (diff) |
add zsh
Diffstat (limited to 'oh-my-zsh/plugins/paver')
-rw-r--r-- | oh-my-zsh/plugins/paver/README.md | 12 | ||||
-rw-r--r-- | oh-my-zsh/plugins/paver/paver.plugin.zsh | 16 |
2 files changed, 28 insertions, 0 deletions
diff --git a/oh-my-zsh/plugins/paver/README.md b/oh-my-zsh/plugins/paver/README.md new file mode 100644 index 0000000..c38d898 --- /dev/null +++ b/oh-my-zsh/plugins/paver/README.md @@ -0,0 +1,12 @@ +# Paver + +This plugin adds completion for the `paver` command-line tool of [Paver](https://pythonhosted.org/Paver/). + +To use it, add `paver` to the plugins array of your zshrc file: +```zsh +plugins=(... paver) +``` + +The completion function creates a cache of paver tasks with the name `.paver_tasks`, +in the current working directory. It regenerates that cache when the `pavement.py` +changes. diff --git a/oh-my-zsh/plugins/paver/paver.plugin.zsh b/oh-my-zsh/plugins/paver/paver.plugin.zsh new file mode 100644 index 0000000..7e70ea3 --- /dev/null +++ b/oh-my-zsh/plugins/paver/paver.plugin.zsh @@ -0,0 +1,16 @@ +_paver_does_target_list_need_generating () { + [ ! -f .paver_targets ] && return 0 + [ pavement.py -nt .paver_targets ] && return 0 + return 1 +} + +_paver () { + if [ -f pavement.py ]; then + if _paver_does_target_list_need_generating; then + paver --help 2>&1 |grep '-'|grep -v -e '--'|awk -F '-' '{print $1}'|tr -d ' ' > .paver_targets + fi + compadd `cat .paver_targets` + fi +} + +compdef _paver paver |