* [PATCH] new completion for otool command (macOS)
@ 2017-12-31 2:57 Jun T.
2017-12-31 3:38 ` dana
0 siblings, 1 reply; 4+ messages in thread
From: Jun T. @ 2017-12-31 2:57 UTC (permalink / raw)
To: zsh-workers
diff --git a/Completion/Darwin/Command/_otool b/Completion/Darwin/Command/_otool
new file mode 100644
index 0000000..52f2e48
--- /dev/null
+++ b/Completion/Darwin/Command/_otool
@@ -0,0 +1,47 @@
+#compdef otool
+#
+local opts args files variant curcontext=$context state state_descr line
+typeset -A opt_args
+
+_arguments \
+ '-a[display the archive header]' \
+ '-S[display the contents of the __.SYMDEF file]' \
+ '-f[display the universal headers]' \
+ '-h[display the Mach header]' \
+ '-l[display the load commands]' \
+ '-L[display names and versions of shared libs that the object file uses]' \
+ '-D[display just the internal name of shared lib]' \
+ '-s[display the contents of the specified section]:segment name: :section name: ' \
+ '-t[display the contents of (__TEXT,__text) section]' \
+ '-d[display the contents of (__DATA,__data) section]' \
+ '-o[display the contents of __OBJC segment]' \
+ '-r[display the relocation entries]' \
+ '-c[display the argument strings from a core file]' \
+ '-I[display the indirect symbol table]' \
+ '-T[display the table of contents for a dynamic shared library]' \
+ '-R[display the reference table of a dynamic shared library]' \
+ '-M[display the module table of dymamic shared library]' \
+ '-H[display the two-level namespace hints table]' \
+ '-G[display the data in code table]' \
+ '-C[display the linker optimization hints]' \
+ '-P[print the info_plist section as strings]' \
+ '-p[with -t and -v/V: start disassembly from the specified symbol]:symbol name: ' \
+ '-v[display verbosely (symbolically) when possible]' \
+ '-V[display disassembled operands symbolically]' \
+ "-X[don't print leading addresses/headers with disassembly]" \
+ '-q[use the llvm disassembler (default)]' \
+ '-mcpu=[use the specified cpu for the llvm disassembler]:target:->targets' \
+ '-function_offsets[with disassembly, print decimal offset from the last label]' \
+ '-j[with disassembly, print opcode bytes]' \
+ "-Q[use otool's disassembler]" \
+ '-arch[select the specified architecture from a universal file]:arch:(i386 x86_64)' \
+ '-m[object file names are not assuemd to be in archive(member) syntax]' \
+ '(- *)--version[print version of otool]' \
+ '*:file:_object_files' && return 0
+
+case $state in
+ targets)
+ _values "target architecture" "${(z)${(@)${(f)$(_call_program targets
+ ${~words[1]} --version 2>/dev/null)##*Registered Targets:}/ -*}}"
+ ;;
+esac
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] new completion for otool command (macOS)
2017-12-31 2:57 [PATCH] new completion for otool command (macOS) Jun T.
@ 2017-12-31 3:38 ` dana
2018-01-04 3:31 ` Jun T
0 siblings, 1 reply; 4+ messages in thread
From: dana @ 2017-12-31 3:38 UTC (permalink / raw)
To: Jun T.; +Cc: zsh-workers
On 30 Dec 2017, at 20:57, Jun T. <takimoto-j@kba.biglobe.ne.jp> wrote:
>diff --git a/Completion/Darwin/Command/_otool b/Completion/Darwin/Command/_otool
Oh, i've actually been sitting on ~40 completion functions, many of them for
macOS, and this was one of them. I didn't want to flood the ML over the holidays
though. Oh well. :/
On 30 Dec 2017, at 20:57, Jun T. <takimoto-j@kba.biglobe.ne.jp> wrote:
>+ '*:file:_object_files' && return 0
btw, _object_files doesn't include the macOS shared-library extension .dylib.
dana
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] new completion for otool command (macOS)
2017-12-31 3:38 ` dana
@ 2018-01-04 3:31 ` Jun T
2018-01-04 17:27 ` dana
0 siblings, 1 reply; 4+ messages in thread
From: Jun T @ 2018-01-04 3:31 UTC (permalink / raw)
To: zsh-workers
> 2017/12/31 12:38, dana <dana@dana.is> wrote:
>
>
> btw, _object_files doesn't include the macOS shared-library extension .dylib.
Yes, but there are a few more extensions (.bundle, .jnilib, and more?) and
Frameworked libraries have no extension. But in my experience they always
have execution permission, so I didn't add these extensions to _objdct_files.
If there is a possibility that .dylib does not have an execution permission,
then please add it to _object_files.
Jun
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] new completion for otool command (macOS)
2018-01-04 3:31 ` Jun T
@ 2018-01-04 17:27 ` dana
0 siblings, 0 replies; 4+ messages in thread
From: dana @ 2018-01-04 17:27 UTC (permalink / raw)
To: Jun T; +Cc: zsh-workers
On 3 Jan 2018, at 21:31, Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
>If there is a possibility that .dylib does not have an execution permission,
>then please add it to _object_files.
I don't have much experience with the other extensions you mentioned (except
.bundle is a directory i thought). But i did look at the .dylib files on my
machine, and it seems pretty well split on whether they'll be executable. Most
of the ones Apple ship in /usr/lib are, but over half of the ones i've got from
Homebrew are not. So i suppose it's worth adding it.
dana
diff --git a/Completion/Unix/Type/_object_files b/Completion/Unix/Type/_object_files
index 70b5b6688..595265116 100644
--- a/Completion/Unix/Type/_object_files
+++ b/Completion/Unix/Type/_object_files
@@ -5,7 +5,7 @@ local expl
_description files expl 'object file'
__object_file() {
- [[ -x $REPLY || $REPLY = *.(a|o|elf) || $REPLY = *.so(.<->)# ||
+ [[ -x $REPLY || $REPLY = *.(a|o|elf|dylib) || $REPLY = *.so(.<->)# ||
$REPLY = (core*|*.core) ]]
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-04 17:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-31 2:57 [PATCH] new completion for otool command (macOS) Jun T.
2017-12-31 3:38 ` dana
2018-01-04 3:31 ` Jun T
2018-01-04 17:27 ` dana
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).