Blob Blame History Raw
From 918eb4c10b60a58ea6b14bea7b9fbfba4d29598c Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 14 Aug 2017 16:13:32 +0200
Subject: [PATCH] zsh.pl: produce a working completion script again

Commit curl-7_54_0-118-g8b2f22e changed the output format of curl --help
to use <file> and <dir> instead of FILE and DIR, which caused zsh.pl to
produce a broken completion script:

% curl --<TAB>
_curl:10: no such file or directory: seconds

Closes #1779

Upstream-commit: ab2a7079cd2a1ec279b1e6b587ba48e50c155e91
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 docs/cmdline-opts/cacert.d | 2 +-
 scripts/zsh.pl             | 5 +++--
 src/tool_help.c            | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/docs/cmdline-opts/cacert.d b/docs/cmdline-opts/cacert.d
index 04e1139..b2ecf90 100644
--- a/docs/cmdline-opts/cacert.d
+++ b/docs/cmdline-opts/cacert.d
@@ -1,5 +1,5 @@
 Long: cacert
-Arg: <CA certificate>
+Arg: <file>
 Help: CA certificate to verify peer against
 Protocols: TLS
 ---
diff --git a/scripts/zsh.pl b/scripts/zsh.pl
index f0d8c19..82b4d9f 100755
--- a/scripts/zsh.pl
+++ b/scripts/zsh.pl
@@ -54,10 +54,11 @@ sub parse_main_opts {
         $option .= '}' if defined $short;
         $option .= '\'[' . trim($desc) . ']\'' if defined $desc;
 
-        $option .= ":$arg" if defined $arg;
+        $option .= ":'$arg'" if defined $arg;
 
         $option .= ':_files'
-            if defined $arg and ($arg eq 'FILE' || $arg eq 'DIR');
+            if defined $arg and ($arg eq '<file>' || $arg eq '<filename>'
+                || $arg eq '<dir>');
 
         push @list, $option;
     }
diff --git a/src/tool_help.c b/src/tool_help.c
index 42dc779..a5bfaba 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -54,7 +54,7 @@ static const struct helptxt helptext[] = {
    "Append to target file when uploading"},
   {"    --basic",
    "Use HTTP Basic Authentication"},
-  {"    --cacert <CA certificate>",
+  {"    --cacert <file>",
    "CA certificate to verify peer against"},
   {"    --capath <dir>",
    "CA directory to verify peer against"},
-- 
2.9.5