zsh-workers
 help / color / mirror / code / Atom feed
* [Patch] fix-zypper-commands-completion
@ 2014-03-15 19:43 Mariusz Fik
  0 siblings, 0 replies; only message in thread
From: Mariusz Fik @ 2014-03-15 19:43 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 262 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 362 bytes --]

[-- Attachment #2: fix-zypper-commands-completion.patch --]
[-- Type: text/x-patch, Size: 1346 bytes --]

From 08c2443e5722b578943d2eccfca708e54dea5d20 Mon Sep 17 00:00:00 2001
From: Mariusz Fik <fisiu@opensuse.org>
Date: Sat, 15 Mar 2014 20:23:51 +0100
Subject: [PATCH] Fix zypper commands completion [zypper <TAB>].

Signed-off-by: Mariusz Fik <fisiu@opensuse.org>
---
 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@homac.de>
 # Copyright (C) 2014 Thomas Mitterfellner <thomas.mitterfellner@gmail.com>
+# Copyright (C) 2014 Mariusz Fik <fisiu@opensuse.org>
 #
 # 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-15 19:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-15 19:43 [Patch] fix-zypper-commands-completion Mariusz Fik

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).