From 8c990e535a0de9f6e5321a37789e6f0a983a033c Mon Sep 17 00:00:00 2001 From: Joshua Davey Date: Mon, 18 Aug 2014 11:00:32 -0500 Subject: [PATCH] Fix up namespace completion * Complete even when test dir is missing * Remove trailing parentheses * Use only one invocation of awk --- zsh_completion.zsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/zsh_completion.zsh b/zsh_completion.zsh index 08644784..7e1752b7 100644 --- a/zsh_completion.zsh +++ b/zsh_completion.zsh @@ -53,10 +53,8 @@ _lein_plugin() { _lein_namespaces() { - if [ -d test ]; then - _values "lein valid namespaces" $(find $1 -type f -name "*.clj" -exec grep -E \ - '^\(ns[[:space:]]+\w+' '{}' ';' | awk '/\(ns[ ]*([A-Za-z\.]+)/ {print $2}') - fi + _values "lein valid namespaces" \ + $(find "$1" -type f -name "*.clj" -exec awk '/^\(ns */ {gsub("\\)", "", $2); print $2}' '{}' '+') } _lein_run() {