about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorluc <luc.lists@gmail.com>2014-02-06 02:50:34 +0100
committerPeter Stephenson <pws@zsh.org>2014-02-06 09:40:36 +0000
commit1af0d645523f90a9513e1b2974937614bbc6e70c (patch)
tree27ade450e4a159ebfbc36d81590bd80b9b72c8a6 /Completion
parent137b15a44704917ff2d765d574714accc7e3d5b1 (diff)
downloadzsh-1af0d645523f90a9513e1b2974937614bbc6e70c.tar.gz
zsh-1af0d645523f90a9513e1b2974937614bbc6e70c.tar.xz
zsh-1af0d645523f90a9513e1b2974937614bbc6e70c.zip
18406: New completion for system_profiler
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Darwin/Command/.distfiles8
-rw-r--r--Completion/Darwin/Command/_system_profiler20
2 files changed, 27 insertions, 1 deletions
diff --git a/Completion/Darwin/Command/.distfiles b/Completion/Darwin/Command/.distfiles
index e52f4a980..5756f542d 100644
--- a/Completion/Darwin/Command/.distfiles
+++ b/Completion/Darwin/Command/.distfiles
@@ -1,4 +1,10 @@
 DISTFILES_SRC='
 .distfiles
-_defaults _fink _hdiutil _open _qtplay _softwareupdate
+_defaults
+_fink
+_hdiutil
+_open
+_qtplay
+_softwareupdate
+_system_profiler
 '
diff --git a/Completion/Darwin/Command/_system_profiler b/Completion/Darwin/Command/_system_profiler
new file mode 100644
index 000000000..fe197579d
--- /dev/null
+++ b/Completion/Darwin/Command/_system_profiler
@@ -0,0 +1,20 @@
+#compdef system_profiler
+
+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]} )
+
+_arguments \
+  '(- *)-usage' \
+  '(- *)-listDataTypes[lists the available datatypes]' \
+  '(-listDataTypes -usage)-xml[generate xml 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)"