Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[Patch] fix-zypper-commands-completion



Hi,

current version of _zypper file completion completes only global options. This patch fixes it, and now after typing `zypper <TAB>`, besides global options, all commands are on the list.

--
Pozdrawiam / Best regards,
Mariusz Fik,
openSUSE Community Member
From 08c2443e5722b578943d2eccfca708e54dea5d20 Mon Sep 17 00:00:00 2001
From: Mariusz Fik <fisiu@xxxxxxxxxxxx>
Date: Sat, 15 Mar 2014 20:23:51 +0100
Subject: [PATCH] Fix zypper commands completion [zypper <TAB>].

Signed-off-by: Mariusz Fik <fisiu@xxxxxxxxxxxx>
---
 Completion/openSUSE/Command/_zypper | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Completion/openSUSE/Command/_zypper b/Completion/openSUSE/Command/_zypper
index ef8ca20..25a32c3 100644
--- a/Completion/openSUSE/Command/_zypper
+++ b/Completion/openSUSE/Command/_zypper
@@ -2,6 +2,7 @@
 #
 # Copyright (C) 2009 Holger Macht <holger@xxxxxxxx>
 # Copyright (C) 2014 Thomas Mitterfellner <thomas.mitterfellner@xxxxxxxxx>
+# Copyright (C) 2014 Mariusz Fik <fisiu@xxxxxxxxxxxx>
 #
 # This file is released under the GPLv2.
 #
@@ -45,8 +46,10 @@ _zypper() {
             # start parsing with "Global Options:"
             [[ $hline =~ "^Global Options:" ]] && tag=1
             [[ $tag = 0 ]] && continue
+            # skip empty lines
+            [[ $hline =~ ^\s*$ ]] && continue
             # all commands have to start with lower case letters
-            [[ $hline[1] =~ ^[A-Z] ]] && continue
+            [[ $hline == [[:upper:]]* ]] && continue
             (( ${#hline} < 2 )) && continue
 
             # cut comma at end of command
-- 
1.8.4.5



Messages sorted by: Reverse Date, Date, Thread, Author