From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4791 invoked by alias); 8 Oct 2014 08:28:42 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33381 Received: (qmail 5031 invoked from network); 8 Oct 2014 08:28:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=x-sasl-enc:date:from:to:subject:message-id :mime-version:content-type; s=mesmtp; bh=f4iUDYc8yZj+Xo/vh0XYhOy VeU0=; b=xw5uQhvJeNTeCdUWTMyawJCgphA390MWJ9+dnjsQtKxqltDBTEf10Gm sGeP62A00d3ZWva1LHEg6yk/rp9mKf+9pyPOS8Z+JsCjyEGq08wJ07G8v0mjYk8v nyw3hbYt9oafOm7eBM6059fUwaY7+V9MNvSIIcwRUEq6B2yxR2hM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:date:from:to:subject :message-id:mime-version:content-type; s=smtpout; bh=f4iUDYc8yZj +Xo/vh0XYhOyVeU0=; b=EYqOm5xNFX9EiD24YF7K2/tWE4JKQ5fY4uQqWUmHhGb HVyUdYJo8ayeticzw3UpxbsnliWUmgAyLLZAGT8PzfdF+qFlh+IUOYHNU5Bj7Qah Ul5fiyACSMWHOinbn/NMlMG8c47OXJbgI+V4DJZYYurhKWMKHOUzkVHOQ+PCGmVQ = X-Sasl-enc: v4JKqgoeapSXLGfmU2aDi/dWhkmVbcFHvM3iH5yiqxnx 1412756418 Date: Wed, 8 Oct 2014 08:20:16 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] Add xxd completion Message-ID: <20141008082016.GC1712@tarsus.local2> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Attached completion for xxd (a hex dump utility from Vim). It works, but I haven't written completion functions before so I might have overlooked something. Cheers, Daniel --zYM0uCDKw75PZbzx Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="0001-Add-xxd-completion.patch" >>From 104556bea66766b73f0b7b0812973c6da300670a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 9 Jul 2014 16:23:53 +0000 Subject: [PATCH] Add xxd completion --- Completion/Unix/Command/_xxd | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Completion/Unix/Command/_xxd diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd new file mode 100644 index 0000000..62cf628 --- /dev/null +++ b/Completion/Unix/Command/_xxd @@ -0,0 +1,48 @@ +#compdef xxd + +local curcontext="$curcontext" ret=1 arguments + +# TODO: permit two hyphens (--autoskip, --groupsize, etc) +# TODO: xxd - should show '-x' and '-x:' differently - give visual hint that there's a required argument + +# Output options compatibility matrix +# +# 0 - options conflict +# 1 - options coexist +# +# (The matrix is symmetric, so implied values are not shown.) +# +# bEipru +# bx10000 +# E-x0001 +# i--x001 +# p---x11 +# r----x0 +# u-----x + + +arguments=( + # output options + '(-b -bits -i -include -p -postscript -plain -ps -r -reverse -u -uppercase)'{-b,-bits}'[output in binary digits, rather than hex]' + '( -E -EBCDIC -i -include -p -postscript -plain -ps -r -reverse )'{-E,-EBCDIC}'[print human-readable part in EBCDIC rather than ASCII]' + '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps -r -reverse )'{-i,-include}'[output in C include file style]' + '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps )'{-p,-postscript,-plain,-ps}'[read or write a plain hexdump (no line numbers or ASCII rendering)]' + + '(-b -bits -E -EBCDIC -i -include -r -reverse -u -uppercase)'{-r,-reverse}'[reverse mode\: read a hex dump and output binary data]' + '(-b -bits -r -reverse -u -uppercase)'{-u,-uppercase}'[output upper-case hex digits]' + + {-h,-help}'[display usage message]' + {-v,-version}'[show program version]' + '*'{-a,-autoskip}"[a single '*' replaces runs of NUL (toggleable)]" + + {-c+,-cols}'[output ARG octets per line]:number of octets per line' + {-g+,-groupsize}'[separate the output every ARG octets]:number of octets per group' + {-l+,-len}'[output ARG octets]:number of octets to output' + {-s,-skip,-seek}'[add ARG to file positions in the input]:file offset (absolute or relative)' + + ':files:_files' +) + +_arguments -S $arguments && ret=0 + +return ret -- 1.7.10.4 --zYM0uCDKw75PZbzx--