zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 0/4] Update macOS command completions
@ 2023-08-23  4:00 Shohei YOSHIDA
  2023-08-23  4:00 ` [PATCH 1/4] Update system_profiler completion Shohei YOSHIDA
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Shohei YOSHIDA @ 2023-08-23  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: Shohei YOSHIDA

References
- https://keith.github.io/xcode-man-pages/open.1.html
- https://keith.github.io/xcode-man-pages/otool-classic.1.html
- https://keith.github.io/xcode-man-pages/sw_vers.1.html
- https://keith.github.io/xcode-man-pages/system_profiler.8.html

Shohei YOSHIDA (4):
  Update system_profiler completion
  Update sw_vers completion
  Update otool completion
  Update open completion

 Completion/Darwin/Command/_open            | 8 +++++++-
 Completion/Darwin/Command/_otool           | 7 ++++++-
 Completion/Darwin/Command/_sw_vers         | 7 ++++---
 Completion/Darwin/Command/_system_profiler | 3 ++-
 4 files changed, 19 insertions(+), 6 deletions(-)

-- 
2.42.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/4] Update system_profiler completion
  2023-08-23  4:00 [PATCH 0/4] Update macOS command completions Shohei YOSHIDA
@ 2023-08-23  4:00 ` Shohei YOSHIDA
  2023-08-25  4:56   ` Jun T
  2023-08-25  5:11   ` Jun T
  2023-08-23  4:00 ` [PATCH 2/4] Update sw_vers completion Shohei YOSHIDA
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 18+ messages in thread
From: Shohei YOSHIDA @ 2023-08-23  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: Shohei YOSHIDA

---
 Completion/Darwin/Command/_system_profiler | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Completion/Darwin/Command/_system_profiler b/Completion/Darwin/Command/_system_profiler
index fe197579d..061b68eba 100644
--- a/Completion/Darwin/Command/_system_profiler
+++ b/Completion/Darwin/Command/_system_profiler
@@ -14,7 +14,8 @@ _data_types=( SP{AirPort,Applications,Audio,Bluetooth,Camera,CardReader,Componen
 _arguments \
   '(- *)-usage' \
   '(- *)-listDataTypes[lists the available datatypes]' \
-  '(-listDataTypes -usage)-xml[generate xml output]' \
+  '(-listDataTypes -usage -json)-xml[generate xml output]' \
+  '(-listDataTypes -usage -xml)-json[generate json output]' \
   '(-listDataTypes -usage)-detailLevel[level of detail for the report]:detail level:(mini basic full)' \
   '(-listDataTypes -usage)-timeout+[maximum time to wait in seconds]' \
   '(-listDataTypes -usage)*:data type:'"($_data_types)"
-- 
2.42.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 2/4] Update sw_vers completion
  2023-08-23  4:00 [PATCH 0/4] Update macOS command completions Shohei YOSHIDA
  2023-08-23  4:00 ` [PATCH 1/4] Update system_profiler completion Shohei YOSHIDA
@ 2023-08-23  4:00 ` Shohei YOSHIDA
  2023-08-25  5:01   ` Jun T
  2023-08-23  4:00 ` [PATCH 3/4] Update otool completion Shohei YOSHIDA
  2023-08-23  4:00 ` [PATCH 4/4] Update open completion Shohei YOSHIDA
  3 siblings, 1 reply; 18+ messages in thread
From: Shohei YOSHIDA @ 2023-08-23  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: Shohei YOSHIDA

- Add 'productVersionExtra' flag
- Use '--' double dashes instead of '-' single dash
  Its manpage says "sw_vers is backwards compatible with previous versions
  which expect options passed with a single dash"
---
 Completion/Darwin/Command/_sw_vers | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Completion/Darwin/Command/_sw_vers b/Completion/Darwin/Command/_sw_vers
index 11814e0b0..b5b26580e 100644
--- a/Completion/Darwin/Command/_sw_vers
+++ b/Completion/Darwin/Command/_sw_vers
@@ -1,6 +1,7 @@
 #compdef sw_vers
 
 _arguments : \
-  '(-)-buildVersion[display build version only]' \
-  '(-)-productName[display product name only]' \
-  '(-)-productVersion[display product version only]'
+  '(-)--buildVersion[display build version only]' \
+  '(-)--productName[display product name only]' \
+  '(-)--productVersion[display product version only]' \
+  '(-)--productVersionExtra[display rapid security response version only]'
-- 
2.42.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 3/4] Update otool completion
  2023-08-23  4:00 [PATCH 0/4] Update macOS command completions Shohei YOSHIDA
  2023-08-23  4:00 ` [PATCH 1/4] Update system_profiler completion Shohei YOSHIDA
  2023-08-23  4:00 ` [PATCH 2/4] Update sw_vers completion Shohei YOSHIDA
@ 2023-08-23  4:00 ` Shohei YOSHIDA
  2023-08-25 15:16   ` Jun. T
  2023-08-23  4:00 ` [PATCH 4/4] Update open completion Shohei YOSHIDA
  3 siblings, 1 reply; 18+ messages in thread
From: Shohei YOSHIDA @ 2023-08-23  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: Shohei YOSHIDA

- Add new options
- Add arm64 to architecture list
---
 Completion/Darwin/Command/_otool | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Completion/Darwin/Command/_otool b/Completion/Darwin/Command/_otool
index c3fc70b91..c754e0b65 100644
--- a/Completion/Darwin/Command/_otool
+++ b/Completion/Darwin/Command/_otool
@@ -13,6 +13,7 @@ _arguments \
   '-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]' \
+  '-x[display the content of every __text section found in the file]' \
   '-d[display the contents of (__DATA,__data) section]' \
   '-o[display the contents of __OBJC segment]' \
   '-r[display the relocation entries]' \
@@ -25,6 +26,9 @@ _arguments \
   '-G[display the data in code table]' \
   '-C[display the linker optimization hints]' \
   '-P[print the info_plist section as strings]' \
+  '-dyld_info[print bind and rebase information used by dyld]' \
+  '-dyld_opcodes[print raw dyld bind and rebase opcodes present in a final linked binary]' \
+  '-chained_fixups[print raw chained fixup data present in a final linked binary]' \
   '-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]' \
@@ -34,7 +38,8 @@ _arguments \
   '-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)' \
+  '-addr_slide=[add an arbitrary slide to each pointer value when it is displayed]:slide size' \
+  '-arch[select the specified architecture from a universal file]:arch:(i386 x86_64 arm64)' \
   '-m[object file names are not assumed to be in archive(member) syntax]' \
   '(- *)--version[print version of otool]' \
   '*:file:_object_files' && return 0
-- 
2.42.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/4] Update open completion
  2023-08-23  4:00 [PATCH 0/4] Update macOS command completions Shohei YOSHIDA
                   ` (2 preceding siblings ...)
  2023-08-23  4:00 ` [PATCH 3/4] Update otool completion Shohei YOSHIDA
@ 2023-08-23  4:00 ` Shohei YOSHIDA
  2023-08-25 16:07   ` Jun. T
  3 siblings, 1 reply; 18+ messages in thread
From: Shohei YOSHIDA @ 2023-08-23  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: Shohei YOSHIDA

---
 Completion/Darwin/Command/_open | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Completion/Darwin/Command/_open b/Completion/Darwin/Command/_open
index 2563e5eb5..1e26dab0e 100644
--- a/Completion/Darwin/Command/_open
+++ b/Completion/Darwin/Command/_open
@@ -25,14 +25,20 @@ _open() {
     '(: * -)--args[pass remaining arguments to application]:*:::argument' \
     '(-a -b -e -f -R -t)-b+[specify application bundle identifier]: :->bundle-ids' \
     '(-a -b -e -f -R -t)-e[open with TextEdit]' \
+    '*--env[add the environment variable of the launched application]:env value' \
     '(-h)-f[open standard input with TextEdit or specified application]' \
     '(-R)-F[open application with fresh state]' \
-    '-g[do not bring application to foreground]' \
+    '(-j)-g[do not bring application to foreground]' \
     '(-f)-h[open library header file]' \
+    '(-g)-j[launch the app hidden]' \
     '(-R)-n[always open new instance of application]' \
     '(-a -b -e -f -F -n -s -t -W --args)-R[reveal in Finder]' \
     '(-R)-s+[specify SDK name/version]: :->sdks' \
+    '--stdin[launch the application with stdin connected to the given file]:file:_files' \
+    '--stdout[launch the application with stdout connected to the given file]:file:_files' \
+    '--stderr[launch the application with stderr connected to the given file]:file:_files' \
     '(-a -b -e -f -R -t)-t[open with default text editor]' \
+    '-u[open URL with whatever application claims the url scheme]:url:_urls' \
     '(-R)-W[wait for application to exit]' \
     '(-f)*: :->files' \
   && ret=0
-- 
2.42.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] Update system_profiler completion
  2023-08-23  4:00 ` [PATCH 1/4] Update system_profiler completion Shohei YOSHIDA
@ 2023-08-25  4:56   ` Jun T
  2023-08-25  5:24     ` Shohei Yoshida
  2023-08-25  5:11   ` Jun T
  1 sibling, 1 reply; 18+ messages in thread
From: Jun T @ 2023-08-25  4:56 UTC (permalink / raw)
  To: zsh-workers


> 2023/08/23 13:00, Shohei YOSHIDA <syohex@gmail.com> wrote:
> 
> ---
> Completion/Darwin/Command/_system_profiler | 3 ++-

The patch is OK, of course.
But _system_profiler has the following comment:

# TODO: Should this be static?  Calling `system_profiler -listDataTypes` takes
# about 0.07-0.08 secs on my machine.  Does this list ever change (between
# different versions of OS X)?
_data_types=( SP{AirPort,Applications,Audio,...(snip)...,WWAN}DataType )
# the dynamic alternative is:
#_data_types=( ${${(f)"$(_call_program path system_profiler -listDataTypes 2>/dev/null)"}[2,-1]} )

At least on macOS Ventura (the latest), "system_profiler -listDataTypes"
gives somewhat different list of data types. And I think the time
required by this command is negligible (I can't notice any delay).
So isn't it better to use the 'dynamic alternative' in the above comment?

The tag name 'path' used in the _call_program is not appropriate.
It would be better to use, for example, 'data-types'.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/4] Update sw_vers completion
  2023-08-23  4:00 ` [PATCH 2/4] Update sw_vers completion Shohei YOSHIDA
@ 2023-08-25  5:01   ` Jun T
  2023-08-25  5:29     ` Shohei Yoshida
  0 siblings, 1 reply; 18+ messages in thread
From: Jun T @ 2023-08-25  5:01 UTC (permalink / raw)
  To: zsh-workers


> 2023/08/23 13:00, Shohei YOSHIDA <syohex@gmail.com> wrote:
> 
> - Use '--' double dashes instead of '-' single dash
>  Its manpage says "sw_vers is backwards compatible with previous versions
>  which expect options passed with a single dash"

Double dashes works only in the latest macOS (Ventura). If single
dash works in Ventura, isn't it better to keep using single dash
(at least while Monterey or older are widely used) ?

Usually, completion function need to support only the latest version
(of the OS or the command), but if it is easy to keep backward
compatibility then I think there is no reason not to do so.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] Update system_profiler completion
  2023-08-23  4:00 ` [PATCH 1/4] Update system_profiler completion Shohei YOSHIDA
  2023-08-25  4:56   ` Jun T
@ 2023-08-25  5:11   ` Jun T
  1 sibling, 0 replies; 18+ messages in thread
From: Jun T @ 2023-08-25  5:11 UTC (permalink / raw)
  To: zsh-workers

Sorry, I noticed another problem in the original code:

> 2023/08/23 13:00, Shohei YOSHIDA <syohex@gmail.com> wrote:
> 
>   '(-listDataTypes -usage)-timeout+[maximum time to wait in seconds]' \

This was not working. We need a ':', and also better to add message,
for example:

'(-listDataTypes -usage)-timeout+[maximum time to wait in seconds]:timeout [seconds] (0 for no timeout)' \



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] Update system_profiler completion
  2023-08-25  4:56   ` Jun T
@ 2023-08-25  5:24     ` Shohei Yoshida
  2023-08-27  7:02       ` Shohei Yoshida
  0 siblings, 1 reply; 18+ messages in thread
From: Shohei Yoshida @ 2023-08-25  5:24 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

On Fri, Aug 25, 2023 at 1:56 PM Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:

>
> # TODO: Should this be static?  Calling `system_profiler -listDataTypes`
> takes
> # about 0.07-0.08 secs on my machine.  Does this list ever change (between
> # different versions of OS X)?
> _data_types=( SP{AirPort,Applications,Audio,...(snip)...,WWAN}DataType )
> # the dynamic alternative is:
> #_data_types=( ${${(f)"$(_call_program path system_profiler -listDataTypes
> 2>/dev/null)"}[2,-1]} )
>
> At least on macOS Ventura (the latest), "system_profiler -listDataTypes"
> gives somewhat different list of data types. And I think the time
> required by this command is negligible (I can't notice any delay).
> So isn't it better to use the 'dynamic alternative' in the above comment?
>

I think the dynamic alternative is better if possible.

-- 
Shohei YOSHIDA(syohex@gmail.com)
<http://b.hatena.ne.jp/entry/https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.ja.tLQrNXCHmdo.O/m=m_i,t,it/am=nBHH5b_7g8gZ7tIn1f7977tLmp39J3_3JgBC2Amo_5v9P4jWA_ug_FA/rt=h/d=1/t=zcms/rs=AItRSTNJwrjV1i8LKqdsHFfbx47Tnlb-Bw>

[-- Attachment #2: Type: text/html, Size: 2040 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/4] Update sw_vers completion
  2023-08-25  5:01   ` Jun T
@ 2023-08-25  5:29     ` Shohei Yoshida
  2023-08-27  6:53       ` Shohei Yoshida
  0 siblings, 1 reply; 18+ messages in thread
From: Shohei Yoshida @ 2023-08-25  5:29 UTC (permalink / raw)
  To: zsh-workers

On Fri, Aug 25, 2023 at 2:02 PM Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
>
>
> > 2023/08/23 13:00, Shohei YOSHIDA <syohex@gmail.com> wrote:
> >
> > - Use '--' double dashes instead of '-' single dash
> >  Its manpage says "sw_vers is backwards compatible with previous versions
> >  which expect options passed with a single dash"
>
> Double dashes works only in the latest macOS (Ventura). If single
> dash works in Ventura, isn't it better to keep using single dash
> (at least while Monterey or older are widely used) ?
>

I think it is ok to keep using a single dash.

-- 
Shohei YOSHIDA(syohex@gmail.com)


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/4] Update otool completion
  2023-08-23  4:00 ` [PATCH 3/4] Update otool completion Shohei YOSHIDA
@ 2023-08-25 15:16   ` Jun. T
       [not found]     ` <CAFX6MONwMeWWVmUScwqq1zUiHhebF6+fhi3kvDk1pP=VR7y_oQ@mail.gmail.com>
  0 siblings, 1 reply; 18+ messages in thread
From: Jun. T @ 2023-08-25 15:16 UTC (permalink / raw)
  To: zsh-workers


> 2023/08/23 13:00, Shohei YOSHIDA <syohex@gmail.com> wrote:

> +  '-arch[select the specified architecture from a universal file]:arch:(i386 x86_64 arm64)' \

On my MacBooks with M1 or M2 CPUs I need to use '-arch arm64e'
instead of '-arch arm64'. 'man arch' shows there is also x86_64h
for Haswell-compatible CPU. And -arch also accepts "all" to select
all architectures. So the list of possibilities would be
(i386 x86_64 x86_64h arm64 arm64e)



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] Update open completion
  2023-08-23  4:00 ` [PATCH 4/4] Update open completion Shohei YOSHIDA
@ 2023-08-25 16:07   ` Jun. T
  2023-08-27  7:18     ` Shohei Yoshida
       [not found]     ` <CAH+w=7Z3AKE4Z3EKN7j9Qh+0UPzJgWjibJ7LmqFQ5xN+QSr5Sw@mail.gmail.com>
  0 siblings, 2 replies; 18+ messages in thread
From: Jun. T @ 2023-08-25 16:07 UTC (permalink / raw)
  To: zsh-workers


> 2023/08/23 13:00, Shohei YOSHIDA <syohex@gmail.com> wrote:

> +    '*--env[add the environment variable of the launched application]:env value' \

You can complete parameter names by using _parameters
(although it may not be so useful here).

To complete only exported parameters:
_parameters -g "*export*"
See the description of _parameters in 'man zshcompsys'.

# -g "*export*" may be too restrictive, but I feel it is enough.

The manpage (for _parameters) also says:
'All other arguments are passed to the compadd builtin.'
So you can pass the options -qS= to compadd by:

'*--env[add variable to the environment of the launched application]:environment variable:_parameters -g "*export*" -qS='

# -qS= is to add a '=' after the parameter name, but remove
# the '=' if user types a space.


Could you please post the revised versions of _system_profiler,
_sw_vers, _otool and _open?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/4] Update sw_vers completion
  2023-08-25  5:29     ` Shohei Yoshida
@ 2023-08-27  6:53       ` Shohei Yoshida
  0 siblings, 0 replies; 18+ messages in thread
From: Shohei Yoshida @ 2023-08-27  6:53 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 1066 bytes --]

attached fixed single dash version

On Fri, Aug 25, 2023 at 2:29 PM Shohei Yoshida <syohex@gmail.com> wrote:

> On Fri, Aug 25, 2023 at 2:02 PM Jun T <takimoto-j@kba.biglobe.ne.jp>
> wrote:
> >
> >
> > > 2023/08/23 13:00, Shohei YOSHIDA <syohex@gmail.com> wrote:
> > >
> > > - Use '--' double dashes instead of '-' single dash
> > >  Its manpage says "sw_vers is backwards compatible with previous
> versions
> > >  which expect options passed with a single dash"
> >
> > Double dashes works only in the latest macOS (Ventura). If single
> > dash works in Ventura, isn't it better to keep using single dash
> > (at least while Monterey or older are widely used) ?
> >
>
> I think it is ok to keep using a single dash.
>
> --
> Shohei YOSHIDA(syohex@gmail.com)
>


-- 
Shohei YOSHIDA(syohex@gmail.com)
<http://b.hatena.ne.jp/entry/https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.ja.tLQrNXCHmdo.O/m=m_i,t,it/am=nBHH5b_7g8gZ7tIn1f7977tLmp39J3_3JgBC2Amo_5v9P4jWA_ug_FA/rt=h/d=1/t=zcms/rs=AItRSTNJwrjV1i8LKqdsHFfbx47Tnlb-Bw>

[-- Attachment #1.2: Type: text/html, Size: 2175 bytes --]

[-- Attachment #2: 0001-Update-sw_vers-completion.patch --]
[-- Type: application/octet-stream, Size: 888 bytes --]

From 745dd8112b24c8503b765601ba7515f2970a5999 Mon Sep 17 00:00:00 2001
From: Shohei YOSHIDA <syohex@gmail.com>
Date: Sun, 27 Aug 2023 15:30:59 +0900
Subject: [PATCH] Update sw_vers completion

Single dash option is deprecated but still use it for older macOS
---
 Completion/Darwin/Command/_sw_vers | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Completion/Darwin/Command/_sw_vers b/Completion/Darwin/Command/_sw_vers
index 11814e0b0..f0c9df2b8 100644
--- a/Completion/Darwin/Command/_sw_vers
+++ b/Completion/Darwin/Command/_sw_vers
@@ -3,4 +3,5 @@
 _arguments : \
   '(-)-buildVersion[display build version only]' \
   '(-)-productName[display product name only]' \
-  '(-)-productVersion[display product version only]'
+  '(-)-productVersion[display product version only]' \
+  '(-)-productVersionExtra[display rapid security response version only]'
-- 
2.42.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] Update system_profiler completion
  2023-08-25  5:24     ` Shohei Yoshida
@ 2023-08-27  7:02       ` Shohei Yoshida
  0 siblings, 0 replies; 18+ messages in thread
From: Shohei Yoshida @ 2023-08-27  7:02 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 1543 bytes --]

attached fixed version.

On Fri, Aug 25, 2023 at 2:24 PM Shohei Yoshida <syohex@gmail.com> wrote:

>
>
> On Fri, Aug 25, 2023 at 1:56 PM Jun T <takimoto-j@kba.biglobe.ne.jp>
> wrote:
>
>>
>> # TODO: Should this be static?  Calling `system_profiler -listDataTypes`
>> takes
>> # about 0.07-0.08 secs on my machine.  Does this list ever change (between
>> # different versions of OS X)?
>> _data_types=( SP{AirPort,Applications,Audio,...(snip)...,WWAN}DataType )
>> # the dynamic alternative is:
>> #_data_types=( ${${(f)"$(_call_program path system_profiler
>> -listDataTypes 2>/dev/null)"}[2,-1]} )
>>
>> At least on macOS Ventura (the latest), "system_profiler -listDataTypes"
>> gives somewhat different list of data types. And I think the time
>> required by this command is negligible (I can't notice any delay).
>> So isn't it better to use the 'dynamic alternative' in the above comment?
>>
>
> I think the dynamic alternative is better if possible.
>
> --
> Shohei YOSHIDA(syohex@gmail.com)
> <http://b.hatena.ne.jp/entry/https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.ja.tLQrNXCHmdo.O/m=m_i,t,it/am=nBHH5b_7g8gZ7tIn1f7977tLmp39J3_3JgBC2Amo_5v9P4jWA_ug_FA/rt=h/d=1/t=zcms/rs=AItRSTNJwrjV1i8LKqdsHFfbx47Tnlb-Bw>
>


-- 
Shohei YOSHIDA(syohex@gmail.com)
<http://b.hatena.ne.jp/entry/https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.ja.tLQrNXCHmdo.O/m=m_i,t,it/am=nBHH5b_7g8gZ7tIn1f7977tLmp39J3_3JgBC2Amo_5v9P4jWA_ug_FA/rt=h/d=1/t=zcms/rs=AItRSTNJwrjV1i8LKqdsHFfbx47Tnlb-Bw>

[-- Attachment #1.2: Type: text/html, Size: 3267 bytes --]

[-- Attachment #2: 0001-Update-system_profiler-completion.patch --]
[-- Type: application/octet-stream, Size: 2327 bytes --]

From eb3683b889ff2420bb5a3ad5fe2509ddc236a2b7 Mon Sep 17 00:00:00 2001
From: Shohei YOSHIDA <syohex@gmail.com>
Date: Sun, 27 Aug 2023 15:58:26 +0900
Subject: [PATCH] Update system_profiler completion

- add new option completions
- fix timout completion that takes seconds
- generate data types dynamically
---
 Completion/Darwin/Command/_system_profiler | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/Completion/Darwin/Command/_system_profiler b/Completion/Darwin/Command/_system_profiler
index fe197579d..0fd8b473b 100644
--- a/Completion/Darwin/Command/_system_profiler
+++ b/Completion/Darwin/Command/_system_profiler
@@ -4,17 +4,13 @@ typeset -A opt_args
 local context state state_descr line
 local -a _data_types
 
-# TODO: Should this be static?  Calling `system_profiler -listDataTypes` takes
-# about 0.07-0.08 secs on my machine.  Does this list ever change (between
-# different versions of OS X)?
-_data_types=( SP{AirPort,Applications,Audio,Bluetooth,Camera,CardReader,Component,ConfigurationProfile,DeveloperTools,Diagnostics,DisabledSoftware,DiscBurning,Displays,Ethernet,Extensions,FibreChannel,FireWire,Firewall,Fonts,Frameworks,Hardware,HardwareRAID,InstallHistory,Logs,ManagedClient,Memory,Network,NetworkLocation,NetworkVolume,PCI,ParallelATA,ParallelSCSI,Power,PrefPane,Printers,PrintersSoftware,SAS,SPI,SerialATA,Software,StartupItem,Storage,SyncServices,Thunderbolt,USB,UniversalAccess,WWAN}DataType )
-# the dynamic alternative is:
-#_data_types=( ${${(f)"$(_call_program path system_profiler -listDataTypes 2>/dev/null)"}[2,-1]} )
+_data_types=( ${${(f)"$(_call_program data-types system_profiler -listDataTypes 2>/dev/null)"}[2,-1]} )
 
 _arguments \
   '(- *)-usage' \
   '(- *)-listDataTypes[lists the available datatypes]' \
-  '(-listDataTypes -usage)-xml[generate xml output]' \
+  '(-listDataTypes -usage -json)-xml[generate xml output]' \
+  '(-listDataTypes -usage -xml)-json[generate json output]' \
   '(-listDataTypes -usage)-detailLevel[level of detail for the report]:detail level:(mini basic full)' \
-  '(-listDataTypes -usage)-timeout+[maximum time to wait in seconds]' \
+  '(-listDataTypes -usage)-timeout+[maximum time to wait in seconds(0 means no timeout)]:timeout seconds' \
   '(-listDataTypes -usage)*:data type:'"($_data_types)"
-- 
2.42.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] Update open completion
  2023-08-25 16:07   ` Jun. T
@ 2023-08-27  7:18     ` Shohei Yoshida
       [not found]     ` <CAH+w=7Z3AKE4Z3EKN7j9Qh+0UPzJgWjibJ7LmqFQ5xN+QSr5Sw@mail.gmail.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Shohei Yoshida @ 2023-08-27  7:18 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 1366 bytes --]

Attached updated open completion patch

On Sat, Aug 26, 2023 at 1:08 AM Jun. T <takimoto-j@kba.biglobe.ne.jp> wrote:

>
> > 2023/08/23 13:00, Shohei YOSHIDA <syohex@gmail.com> wrote:
>
> > +    '*--env[add the environment variable of the launched
> application]:env value' \
>
> You can complete parameter names by using _parameters
> (although it may not be so useful here).
>
> To complete only exported parameters:
> _parameters -g "*export*"
> See the description of _parameters in 'man zshcompsys'.
>
> # -g "*export*" may be too restrictive, but I feel it is enough.
>
> The manpage (for _parameters) also says:
> 'All other arguments are passed to the compadd builtin.'
> So you can pass the options -qS= to compadd by:
>
> '*--env[add variable to the environment of the launched
> application]:environment variable:_parameters -g "*export*" -qS='
>
> # -qS= is to add a '=' after the parameter name, but remove
> # the '=' if user types a space.
>
>
> Could you please post the revised versions of _system_profiler,
> _sw_vers, _otool and _open?
>


-- 
Shohei YOSHIDA(syohex@gmail.com)
<http://b.hatena.ne.jp/entry/https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.ja.tLQrNXCHmdo.O/m=m_i,t,it/am=nBHH5b_7g8gZ7tIn1f7977tLmp39J3_3JgBC2Amo_5v9P4jWA_ug_FA/rt=h/d=1/t=zcms/rs=AItRSTNJwrjV1i8LKqdsHFfbx47Tnlb-Bw>

[-- Attachment #1.2: Type: text/html, Size: 2387 bytes --]

[-- Attachment #2: 0001-Update-open-completion.patch --]
[-- Type: application/octet-stream, Size: 1866 bytes --]

From ed91e5188cb0a6f6496fe79e96926b6670793938 Mon Sep 17 00:00:00 2001
From: Shohei YOSHIDA <syohex@gmail.com>
Date: Sun, 27 Aug 2023 16:16:17 +0900
Subject: [PATCH] Update open completion

- support new options
---
 Completion/Darwin/Command/_open | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Completion/Darwin/Command/_open b/Completion/Darwin/Command/_open
index 2563e5eb5..83f434cdb 100644
--- a/Completion/Darwin/Command/_open
+++ b/Completion/Darwin/Command/_open
@@ -25,14 +25,20 @@ _open() {
     '(: * -)--args[pass remaining arguments to application]:*:::argument' \
     '(-a -b -e -f -R -t)-b+[specify application bundle identifier]: :->bundle-ids' \
     '(-a -b -e -f -R -t)-e[open with TextEdit]' \
+    '*--env[add the environment variable of the launched application]:env value:_parameters -g "*export*" -qS=' \
     '(-h)-f[open standard input with TextEdit or specified application]' \
     '(-R)-F[open application with fresh state]' \
-    '-g[do not bring application to foreground]' \
+    '(-j)-g[do not bring application to foreground]' \
     '(-f)-h[open library header file]' \
+    '(-g)-j[launch the app hidden]' \
     '(-R)-n[always open new instance of application]' \
     '(-a -b -e -f -F -n -s -t -W --args)-R[reveal in Finder]' \
     '(-R)-s+[specify SDK name/version]: :->sdks' \
+    '--stdin[launch the application with stdin connected to the given file]:file:_files' \
+    '--stdout[launch the application with stdout connected to the given file]:file:_files' \
+    '--stderr[launch the application with stderr connected to the given file]:file:_files' \
     '(-a -b -e -f -R -t)-t[open with default text editor]' \
+    '-u[open URL with whatever application claims the url scheme]:url:_urls' \
     '(-R)-W[wait for application to exit]' \
     '(-f)*: :->files' \
   && ret=0
-- 
2.42.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] Update open completion
       [not found]     ` <CAH+w=7Z3AKE4Z3EKN7j9Qh+0UPzJgWjibJ7LmqFQ5xN+QSr5Sw@mail.gmail.com>
@ 2023-08-28  1:53       ` Jun. T
  0 siblings, 0 replies; 18+ messages in thread
From: Jun. T @ 2023-08-28  1:53 UTC (permalink / raw)
  To: zsh-workers


> 2023/08/28 7:14、Bart Schaefer <schaefer@brasslantern.com>のメール:
> 
> On Fri, Aug 25, 2023 at 9:08 AM Jun. T <takimoto-j@kba.biglobe.ne.jp> wrote:
>> 
>> Could you please post the revised versions of _system_profiler,
>> _sw_vers, _otool and _open?
> 
> Are you going to take care of committing these, or should I go ahead?

Yes, I will.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/4] Update otool completion
       [not found]       ` <F45E2407-3AFA-4925-A247-98013FB3EEAF@kba.biglobe.ne.jp>
@ 2023-08-28  2:32         ` Shohei Yoshida
  2023-08-28  4:02           ` Jun T
  0 siblings, 1 reply; 18+ messages in thread
From: Shohei Yoshida @ 2023-08-28  2:32 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 634 bytes --]

On Mon, Aug 28, 2023 at 11:28 AM Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:

>
> > 2023/08/27 16:04、Shohei Yoshida <syohex@gmail.com>のメール:
> >
> > attached updated version.
>
> Thanks, but the patch is sent only to me.
> Could you please send it to the zsh-workers?
>

Sorry I made a mistake. I send the same patch again to zsh-workers

-- 
Shohei YOSHIDA(syohex@gmail.com)
<http://b.hatena.ne.jp/entry/https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.ja.tLQrNXCHmdo.O/m=m_i,t,it/am=nBHH5b_7g8gZ7tIn1f7977tLmp39J3_3JgBC2Amo_5v9P4jWA_ug_FA/rt=h/d=1/t=zcms/rs=AItRSTNJwrjV1i8LKqdsHFfbx47Tnlb-Bw>

[-- Attachment #1.2: Type: text/html, Size: 1572 bytes --]

[-- Attachment #2: 0001-Update-otool-completion.patch --]
[-- Type: text/x-patch, Size: 2287 bytes --]

From e418cc9111ac6cffbbd3193f9f5ee53af0a086ce Mon Sep 17 00:00:00 2001
From: Shohei YOSHIDA <syohex@gmail.com>
Date: Sun, 27 Aug 2023 16:03:41 +0900
Subject: [PATCH] Update otool completion

- Add new option completions
- Update the archtecture list
---
 Completion/Darwin/Command/_otool | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Completion/Darwin/Command/_otool b/Completion/Darwin/Command/_otool
index c3fc70b91..e0367945c 100644
--- a/Completion/Darwin/Command/_otool
+++ b/Completion/Darwin/Command/_otool
@@ -13,6 +13,7 @@ _arguments \
   '-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]' \
+  '-x[display the content of every __text section found in the file]' \
   '-d[display the contents of (__DATA,__data) section]' \
   '-o[display the contents of __OBJC segment]' \
   '-r[display the relocation entries]' \
@@ -25,6 +26,9 @@ _arguments \
   '-G[display the data in code table]' \
   '-C[display the linker optimization hints]' \
   '-P[print the info_plist section as strings]' \
+  '-dyld_info[print bind and rebase information used by dyld]' \
+  '-dyld_opcodes[print raw dyld bind and rebase opcodes present in a final linked binary]' \
+  '-chained_fixups[print raw chained fixup data present in a final linked binary]' \
   '-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]' \
@@ -34,7 +38,8 @@ _arguments \
   '-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)' \
+  '-addr_slide=[add an arbitrary slide to each pointer value when it is displayed]:slide size' \
+  '-arch[select the specified architecture from a universal file]:arch:(i386 x86_64 x86_64h arm64 arm64e)' \
   '-m[object file names are not assumed to be in archive(member) syntax]' \
   '(- *)--version[print version of otool]' \
   '*:file:_object_files' && return 0
-- 
2.42.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/4] Update otool completion
  2023-08-28  2:32         ` Shohei Yoshida
@ 2023-08-28  4:02           ` Jun T
  0 siblings, 0 replies; 18+ messages in thread
From: Jun T @ 2023-08-28  4:02 UTC (permalink / raw)
  To: zsh-workers


> 2023/08/28 11:32, Shohei Yoshida <syohex@gmail.com> wrote:
> 
> Sorry I made a mistake. I send the same patch again to zsh-workers

Thanks.

> 2023/08/26 0:16, I wrote:
> So the list of possibilities would be
> (i386 x86_64 x86_64h arm64 arm64e)

Sorry, I forgot to include 'all':
(i386 x86_64 x86_64h arm64 arm64e all)

I will push with this (and also _system_profiler, _sw_vers and _open).


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-08-28  4:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23  4:00 [PATCH 0/4] Update macOS command completions Shohei YOSHIDA
2023-08-23  4:00 ` [PATCH 1/4] Update system_profiler completion Shohei YOSHIDA
2023-08-25  4:56   ` Jun T
2023-08-25  5:24     ` Shohei Yoshida
2023-08-27  7:02       ` Shohei Yoshida
2023-08-25  5:11   ` Jun T
2023-08-23  4:00 ` [PATCH 2/4] Update sw_vers completion Shohei YOSHIDA
2023-08-25  5:01   ` Jun T
2023-08-25  5:29     ` Shohei Yoshida
2023-08-27  6:53       ` Shohei Yoshida
2023-08-23  4:00 ` [PATCH 3/4] Update otool completion Shohei YOSHIDA
2023-08-25 15:16   ` Jun. T
     [not found]     ` <CAFX6MONwMeWWVmUScwqq1zUiHhebF6+fhi3kvDk1pP=VR7y_oQ@mail.gmail.com>
     [not found]       ` <F45E2407-3AFA-4925-A247-98013FB3EEAF@kba.biglobe.ne.jp>
2023-08-28  2:32         ` Shohei Yoshida
2023-08-28  4:02           ` Jun T
2023-08-23  4:00 ` [PATCH 4/4] Update open completion Shohei YOSHIDA
2023-08-25 16:07   ` Jun. T
2023-08-27  7:18     ` Shohei Yoshida
     [not found]     ` <CAH+w=7Z3AKE4Z3EKN7j9Qh+0UPzJgWjibJ7LmqFQ5xN+QSr5Sw@mail.gmail.com>
2023-08-28  1:53       ` Jun. T

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).