about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorMatthew Martin <phy1729@gmail.com>2015-12-11 11:51:09 +0100
committerOliver Kiddle <opk@zsh.org>2015-12-11 11:51:09 +0100
commit3272bdce987a3e5d5448688529ccb8290e148a67 (patch)
treeda522e52027805c1f709c75e84633e89676c9cb4 /Completion
parente5dddecc159e7a7e54da3292c132662e1398eeac (diff)
downloadzsh-3272bdce987a3e5d5448688529ccb8290e148a67.tar.gz
zsh-3272bdce987a3e5d5448688529ccb8290e148a67.tar.xz
zsh-3272bdce987a3e5d5448688529ccb8290e148a67.zip
37383: add completion type for object files
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_elfdump6
-rw-r--r--Completion/Unix/Command/_nm6
-rw-r--r--Completion/Unix/Command/_objdump7
-rw-r--r--Completion/Unix/Command/_readelf6
-rw-r--r--Completion/Unix/Type/_object_files11
5 files changed, 15 insertions, 21 deletions
diff --git a/Completion/Unix/Command/_elfdump b/Completion/Unix/Command/_elfdump
index ee92402d2..065f4b97f 100644
--- a/Completion/Unix/Command/_elfdump
+++ b/Completion/Unix/Command/_elfdump
@@ -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]' ) ;;
diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm
index d171ef5a3..73d7508b4 100644
--- a/Completion/Unix/Command/_nm
+++ b/Completion/Unix/Command/_nm
@@ -2,11 +2,7 @@
 
 local args files variant
 
-_nm_object_file() {
-  [[ -x $REPLY || $REPLY = *.([ao]|so|elf) ]]
-}
-
-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]'
diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump
index 607719a19..cc213d911 100644
--- a/Completion/Unix/Command/_objdump
+++ b/Completion/Unix/Command/_objdump
@@ -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'
diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf
index 9312ea864..a474a8dc4 100644
--- a/Completion/Unix/Command/_readelf
+++ b/Completion/Unix/Command/_readelf
@@ -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
diff --git a/Completion/Unix/Type/_object_files b/Completion/Unix/Type/_object_files
new file mode 100644
index 000000000..31a13aefc
--- /dev/null
+++ b/Completion/Unix/Type/_object_files
@@ -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,)'