zsh-workers
 help / color / mirror / code / Atom feed
From: Mariusz Fik <fisiu@opensuse.org>
To: zsh-workers@zsh.org
Subject: [Patch] fix-zypper-commands-completion
Date: Sat, 15 Mar 2014 20:43:12 +0100	[thread overview]
Message-ID: <CAGR5uRXCbVmtC=VWDw37n9vZD47xb=UsgF-wrQOSW_APgs0Q9g@mail.gmail.com> (raw)


[-- 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


                 reply	other threads:[~2014-03-15 19:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGR5uRXCbVmtC=VWDw37n9vZD47xb=UsgF-wrQOSW_APgs0Q9g@mail.gmail.com' \
    --to=fisiu@opensuse.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).