- add completion type for object files

this applies the same fix we have for nm(1) to other programs too

from Matthew Martin
ok pea@ (MAINTAINER)
This commit is contained in:
jasper 2015-12-21 19:13:17 +00:00
parent 4de63cc4c7
commit 047a3abe46
8 changed files with 126 additions and 14 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.78 2015/12/17 18:31:21 jasper Exp $
# $OpenBSD: Makefile,v 1.79 2015/12/21 19:13:17 jasper Exp $
COMMENT= Z shell, Bourne shell-compatible
V= 5.2
DISTNAME= zsh-$V
CATEGORIES= shells
REVISION= 1
REVISION= 2
MAINTAINER= Pierre-Emmanuel Andre <pea@openbsd.org>

View File

@ -1,4 +1,10 @@
$OpenBSD: patch-Completion_BSD_Command__bsd_pkg,v 1.3 2015/11/06 14:17:03 pea Exp $
$OpenBSD: patch-Completion_BSD_Command__bsd_pkg,v 1.4 2015/12/21 19:13:17 jasper Exp $
From 3272bdce987a3e5d5448688529ccb8290e148a67 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Fri, 11 Dec 2015 11:51:09 +0100
Subject: [PATCH] 37383: add completion type for object files
--- Completion/BSD/Command/_bsd_pkg.orig Wed Jan 21 14:53:28 2004
+++ Completion/BSD/Command/_bsd_pkg Mon Jan 23 21:30:02 2006
@@ -6,15 +6,19 @@ _bsd_pkg_pkgfiles() {

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-Completion_Unix_Command__elfdump,v 1.1 2015/12/21 19:13:17 jasper Exp $
From 3272bdce987a3e5d5448688529ccb8290e148a67 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Fri, 11 Dec 2015 11:51:09 +0100
Subject: [PATCH] 37383: add completion type for object files
--- Completion/Unix/Command/_elfdump.orig Sun May 3 19:57:18 2015
+++ Completion/Unix/Command/_elfdump Mon Dec 21 09:54:57 2015
@@ -2,10 +2,6 @@
local -a args
-_elf_file() {
- [[ -x $REPLY || $REPLY = (core*|*.([ao]|so|elf)) ]]
-}
-
args=(
'-c[dump section header information]'
'-d[dump .dynamic section]'
@@ -38,7 +34,7 @@ case $OSTYPE in
'-l[show long section names without truncation]'
'-O[specify osabi to apply]:osabi'
'-P[use alternative section header]'
- "*:elf file:_files -g '*(-.e:_elf_file:)'"
+ "*:elf file:_object_files"
)
;;
freebsd*) args+=( '-a[dump all information]' ) ;;

View File

@ -1,15 +1,22 @@
$OpenBSD: patch-Completion_Unix_Command__nm,v 1.2 2015/12/06 14:18:04 jasper Exp $
$OpenBSD: patch-Completion_Unix_Command__nm,v 1.3 2015/12/21 19:13:17 jasper Exp $
Generate completions for OpenBSD's so versioned files (libfoo.so.0.0)
From 3272bdce987a3e5d5448688529ccb8290e148a67 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Fri, 11 Dec 2015 11:51:09 +0100
Subject: [PATCH] 37383: add completion type for object files
--- Completion/Unix/Command/_nm.orig Sun May 3 19:57:18 2015
+++ Completion/Unix/Command/_nm Sun Dec 6 12:58:30 2015
@@ -3,7 +3,7 @@
--- Completion/Unix/Command/_nm.orig Sat Oct 24 19:06:08 2015
+++ Completion/Unix/Command/_nm Mon Dec 21 10:04:02 2015
@@ -2,11 +2,7 @@
local args files variant
_nm_object_file() {
-_nm_object_file() {
- [[ -x $REPLY || $REPLY = *.([ao]|so|elf) ]]
+ [[ -x $REPLY || $REPLY = *.([ao]|so|elf)((.<->.<->))# ]]
}
files="*:object file:_files -g '*(-.e:_nm_object_file:)'"
-}
-
-files="*:object file:_files -g '*(-.e,_nm_object_file,)'"
+files="*:object file:_object_files"
args=(
'(-A -o --print-file-name)'{-A,-o,--print-file-name}'[print name of input file on each line]'
'(--demangle)-C[decode symbol names]'

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-Completion_Unix_Command__objdump,v 1.1 2015/12/21 19:13:17 jasper Exp $
From 3272bdce987a3e5d5448688529ccb8290e148a67 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Fri, 11 Dec 2015 11:51:09 +0100
Subject: [PATCH] 37383: add completion type for object files
--- Completion/Unix/Command/_objdump.orig Sat Oct 24 19:06:08 2015
+++ Completion/Unix/Command/_objdump Mon Dec 21 09:54:57 2015
@@ -1,8 +1,3 @@
#compdef objdump
-# borrowed from _nm_object_file
-_objdump_object_file() {
- [[ -x $REPLY || $REPLY = *.([ao]|so|elf) ]]
-}
-
-_arguments -- '*:object file:_files -g "*(-.e,_objdump_object_file,)"'
+_arguments -- '*:object file:_object_files'

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-Completion_Unix_Command__readelf,v 1.1 2015/12/21 19:13:17 jasper Exp $
From 3272bdce987a3e5d5448688529ccb8290e148a67 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Fri, 11 Dec 2015 11:51:09 +0100
Subject: [PATCH] 37383: add completion type for object files
--- Completion/Unix/Command/_readelf.orig Sun May 3 19:57:18 2015
+++ Completion/Unix/Command/_readelf Mon Dec 21 09:54:57 2015
@@ -2,10 +2,6 @@
local variant args sections
-_elf_file() {
- [[ -x $REPLY || $REPLY = (core*|*.([ao]|so|elf)) ]]
-}
-
sections=( .bss .data .dynamic .dynsym .got .interp .shstrtab .symtab .text )
_pick_variant -r variant elftoolchain=elftoolchain elfutils=elfutils binutils --version
@@ -29,7 +25,7 @@ args=(
'(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]'
'(- *)'{-H,--help}'[display help information]'
'(- *)'{-v,--version}'[display version information]'
- "*:elf file:_files -g '*(-.e:_elf_file:)'"
+ "*:elf file:_object_files"
)
case $variant in

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-Completion_Unix_Type__object_files,v 1.1 2015/12/21 19:13:17 jasper Exp $
From 3272bdce987a3e5d5448688529ccb8290e148a67 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Fri, 11 Dec 2015 11:51:09 +0100
Subject: [PATCH] 37383: add completion type for object files
--- Completion/Unix/Type/_object_files.orig Mon Dec 21 09:54:57 2015
+++ Completion/Unix/Type/_object_files Mon Dec 21 09:54:57 2015
@@ -0,0 +1,11 @@
+#autoload
+
+local expl
+
+_description files expl 'object file'
+
+__object_file() {
+ [[ -x $REPLY || $REPLY = *.([ao]|so|elf)(.<->)## || $REPLY = (core*|*.core) ]]
+}
+
+_files -g '*(-.e,__object_file,)'

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.42 2015/12/17 18:31:21 jasper Exp $
@comment $OpenBSD: PLIST,v 1.43 2015/12/21 19:13:17 jasper Exp $
@pkgpath shells/zsh,-main
@shell bin/zsh
%%SHARED%%
@ -477,6 +477,7 @@ share/zsh/${V}/functions/_npm
share/zsh/${V}/functions/_nslookup
share/zsh/${V}/functions/_objdump
share/zsh/${V}/functions/_object_classes
share/zsh/${V}/functions/_object_files
share/zsh/${V}/functions/_od
share/zsh/${V}/functions/_okular
share/zsh/${V}/functions/_oldlist