From 5d0a29ee0ac046293e8706fb95ddaaa6ae4b376f Mon Sep 17 00:00:00 2001 From: Shy Date: Mon, 17 Apr 2017 21:25:19 +0200 Subject: [PATCH] Bugfix in preset completion --- _c4ctrl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_c4ctrl b/_c4ctrl index 709fb5a..984da29 100644 --- a/_c4ctrl +++ b/_c4ctrl @@ -34,23 +34,23 @@ _arguments -s \ case "$state" in presets*) - local ret=0 c4ctrl_cfg_dir + local ret=1 c4ctrl_cfg_dir + + if [[ "$state" == "presets_read" ]]; then + # 'off' and 'random' are builtins and always 'readable'. + _values Presets 'off' 'random' + ret=$? + fi if [[ "$XDG_CONFIG_DIR" ]]; then c4ctrl_cfg_dir="$XDG_CONFIG_DIR/c4ctrl" else c4ctrl_cfg_dir="$HOME/.config/c4ctrl" fi if [[ -d "$c4ctrl_cfg_dir" ]]; then - if [[ "$state" == "presets_read" ]]; then - # 'off' and 'random' are builtins and always 'readable'. - _values Presets 'off' 'random' - ret=$? - fi _files -W "$c4ctrl_cfg_dir" ret=$((ret+?)) - return ret fi - return 1 + return ret ;; esac