diff options
author | des <des@FreeBSD.org> | 2009-06-15 23:03:19 +0800 |
---|---|---|
committer | des <des@FreeBSD.org> | 2009-06-15 23:03:19 +0800 |
commit | 9fb648e1aad86ca5d235eac9f69c25eeb55c40cb (patch) | |
tree | 061a4d6d44eafe1e5efce69fbd0cd0803dc7d556 /shells/zsh | |
parent | 1e01ebb4e7c051ef149cfbe00b5cd1df98c4a15a (diff) | |
download | freebsd-ports-gnome-9fb648e1aad86ca5d235eac9f69c25eeb55c40cb.tar.gz freebsd-ports-gnome-9fb648e1aad86ca5d235eac9f69c25eeb55c40cb.tar.zst freebsd-ports-gnome-9fb648e1aad86ca5d235eac9f69c25eeb55c40cb.zip |
Add some upstream completion patches + new completion files for
procstat, sockstat and fstat.
Submitted by: Baptiste Daroussin <baptiste.daroussin@gmail.com>
Diffstat (limited to 'shells/zsh')
-rw-r--r-- | shells/zsh/Makefile | 16 | ||||
-rw-r--r-- | shells/zsh/files/_fstat | 15 | ||||
-rw-r--r-- | shells/zsh/files/_procstat | 17 | ||||
-rw-r--r-- | shells/zsh/files/_sockstat | 23 | ||||
-rw-r--r-- | shells/zsh/files/patch-Completion-Unix-Command-_mount | 92 | ||||
-rw-r--r-- | shells/zsh/files/patch-Completion-Unix-Type-_file_systems | 18 | ||||
-rw-r--r-- | shells/zsh/files/patch-Completion-Unix-Type-_zfs_dataset | 27 |
7 files changed, 171 insertions, 37 deletions
diff --git a/shells/zsh/Makefile b/shells/zsh/Makefile index 8f115418834d..f8c811f357c5 100644 --- a/shells/zsh/Makefile +++ b/shells/zsh/Makefile @@ -7,6 +7,7 @@ PORTNAME= zsh PORTVERSION= 4.3.10 +PORTREVISION= 1 CATEGORIES= shells MASTER_SITES= SF .if !defined(NOPORTDOCS) @@ -32,6 +33,8 @@ CONFIGURE_ARGS= --with-term-lib="ncursesw ncurses" --with-tcsetpgrp \ --enable-function-subdirs EXTRA_PATCHES= ${FILESDIR}/extra-patch-bsdtar +EXTRA_COMPLETION_FILES= _fstat _procstat _sockstat +EXTRA_COMPLETION_DIR= Completion/BSD/Command OPTIONS= ZSH_GDBM "Enable GDBM support (GPL)" off \ ZSH_MEM "Enable zsh-mem and zsh-secure-free options" on \ @@ -99,6 +102,19 @@ post-patch: ${WRKSRC}/Src/Modules/*.mdd @${SED} -i "" -e "s,/etc/,${LOCALBASE}/etc/," \ ${WRKSRC}/Functions/MIME/zsh-mime-setup +.ifdef EXTRA_COMPLETION_FILES + @echo "===> Installing extra completion files" +.for COMPFILE in ${EXTRA_COMPLETION_FILES} + @(if [ -f ${WRKSRC}/${EXTRA_COMPLETION_DIR}/${COMPFILE} ] ; then \ + echo "${EXTRA_COMPLETION_DIR}/${COMPFILE} already exists" ; \ + exit 1 ; \ + else \ + echo ${EXTRA_COMPLETION_DIR}/${COMPFILE} ; \ + ${CP} ${FILESDIR}/${COMPFILE} \ + ${WRKSRC}/${EXTRA_COMPLETION_DIR}/${COMPFILE} ; \ + fi) +.endfor +.endif @${FIND} ${WRKSRC}/Completion -type f -iname '*.orig' -delete post-build: diff --git a/shells/zsh/files/_fstat b/shells/zsh/files/_fstat new file mode 100644 index 000000000000..553d07313c68 --- /dev/null +++ b/shells/zsh/files/_fstat @@ -0,0 +1,15 @@ +#compdef fstat + +local pids +pids=(${${${(f)"$(/usr/bin/procstat -ah)"}/[[:space:]]#/}/[[:space:]]*[[:space:]](ELF32[[:space:]]|-[[:space:]]#)/:}) + +_arguments -s \ +'-f[Restrict examination to files open in the same file systems as the named file arguments]' \ +'-M[Extract values associated with the name list from the specified core]:core:_files' \ +'-N[Extract the name list from the specified system]:system:' \ +'-m[Include memory-mapped files in the listing]' \ +'-n[Numerical format]' \ +'-p[Report all files open by the specified process]:Process id:(($pids))' \ +'-u[Report all files open by the specified user]:User:_users' \ +'-v[Verbose mode]' \ +'*:Files:_files' diff --git a/shells/zsh/files/_procstat b/shells/zsh/files/_procstat new file mode 100644 index 000000000000..476daa8212f9 --- /dev/null +++ b/shells/zsh/files/_procstat @@ -0,0 +1,17 @@ +#compdef procstat + +local pids +#get list of pids and associated process name as comment +pids=(${${${(f)"$(/usr/bin/procstat -ah)"}/[[:space:]]#/}/[[:space:]]*[[:space:]](ELF32[[:space:]]|-[[:space:]]#)/:}) + +_arguments -s \ +'-b[Display binary information for the process]' \ +'-c[Display command line arguments for the process]' \ +'-f[Display file descriptor information for the process]' \ +'-k[Display the stacks of kernel threads in the process]' \ +'-s[Display security credential information for the process]' \ +'-t[Display thread information for the process]' \ +'-v[Display virtual memory mappings for the process]' \ +'-h[Suppress table headers.]' \ +'-a[All processes]' \ +':Process id:(($pids))' diff --git a/shells/zsh/files/_sockstat b/shells/zsh/files/_sockstat new file mode 100644 index 000000000000..2acbe6bec351 --- /dev/null +++ b/shells/zsh/files/_sockstat @@ -0,0 +1,23 @@ +#compdef sockstat + +local tmp_proto protocols proto + +tmp_proto=(${${(M)${(f)"$(</etc/protocols)"}##[a-z0-9]*}}) +for proto ($tmp_proto) { + case $proto in + *\#*) + protocols=($protocols ${${(j: :)${=proto}}// *\# /:}) + ;; + *) + protocols=($protocols ${${(j: :)${=proto}}// */}) + esac +} + +_arguments -s \ + '-4[Show AF_INET (IPv4) sockets]' \ + '-6[Show AF_INET6 (IPv6) sockets]' \ + '-c[Show connected sockets]' \ + '-l[Show listening sockets]' \ + '-u[Show AF_LOCAL (UNIX) sockets]' \ + '-p[Only show Internet sockets if the port number is on the specified list]' \ + '-P[Only show sockets of the specified protocols]:protocols:(($protocols))' diff --git a/shells/zsh/files/patch-Completion-Unix-Command-_mount b/shells/zsh/files/patch-Completion-Unix-Command-_mount index 6853bf96b378..4de9b537984f 100644 --- a/shells/zsh/files/patch-Completion-Unix-Command-_mount +++ b/shells/zsh/files/patch-Completion-Unix-Command-_mount @@ -1,6 +1,6 @@ ---- Completion/Unix/Command/_mount.orig 2008-01-22 04:13:35.000000000 -0600 -+++ Completion/Unix/Command/_mount 2008-10-28 18:23:46.000000000 -0500 -@@ -41,10 +41,10 @@ +--- Completion/Unix/Command/_mount ++++ Completion/Unix/Command/_mount +@@ -41,10 +41,10 @@ fi local curcontext="$curcontext" state line expl suf ret=1 local args deffs=iso9660 tmp typeops=-t _nfs_access _fs_nfs _nfs_ufs \ @@ -15,7 +15,7 @@ typeset -A opt_args -@@ -527,7 +527,7 @@ +@@ -527,7 +527,7 @@ if (( ! $+_fs_any )); then 'swidth[specify stripe width]:size' ) ;; @@ -24,7 +24,7 @@ _fs_any=( '(sync)async[do all I/O asynchronously]' 'current[use current options on already mounted file system]' -@@ -548,12 +548,12 @@ +@@ -548,12 +548,12 @@ if (( ! $+_fs_any )); then 'update[change status of already mounted filesystem]' 'union[cause the namespace at the mount point to appear as the union of the mounted filesystem and the existing directory]' ) @@ -43,24 +43,21 @@ ) _fs_std=( "nodev[don't interpret devices]" -@@ -568,10 +568,13 @@ - _fs_linprocfs=( "$_fs_std[@]" ) - _fs_procfs=( "$_fs_std[@]" ) - _fs_msdos=( -- 'shortnames[]' -- 'longnames[]' -- 'nowin95[]' +@@ -571,7 +571,13 @@ if (( ! $+_fs_any )); then + 'shortnames[]' + 'longnames[]' + 'nowin95[]' + 'shortnames[force only the old MS-DOS 8.3 style filenames to be visible]' + 'longnames[force Windows 95 long filenames to be visible]' + 'nowin95[completely ignore Windows 95 extended file information]' ) + if [[ "${OSTYPE}" =~ freebsd.* ]]; then -+ _fs_msdosfs=( "$_fs_msdos[@]" ) ++ _fs_msdosfs=( "$_fs_msdos[@]" ) + fi ;; esac fi -@@ -682,7 +685,7 @@ +@@ -682,7 +688,7 @@ if [[ "$service" = mount ]]; then deffs=hsfs typeops=-F ;; @@ -69,7 +66,7 @@ args=( -s '(:)-a[mount all filesystems in fstab]' '-d[cause everything to be done except for the actual system call]' -@@ -757,7 +760,7 @@ +@@ -757,7 +763,7 @@ else '*:dev or dir:->udevordir' ) ;; @@ -78,28 +75,63 @@ args=( '(*)-a[unmount all mounted file systems]' '-A[unmount all mounted file systems except the root]' -@@ -819,7 +822,7 @@ +@@ -819,7 +825,28 @@ devordir) fi case "$OSTYPE" in - *freebsd*|dragonfly*) -+ freebsd*|dragonfly*) ++ dragonfly*) ++ while read mline; do ++ case $mline[(w)1] in ++ \#* ) ++ ;; ++ proc) ++ ;; ++ *) ++ [[ $mline[(w)3] == swap ]] || \ ++ dev_tmp+=( $mline[(w)1] ) \ ++ mp_tmp+=( $mline[(w)2] ) ++ ;; ++ esac ++ done < /etc/fstab ++ ++ _alternative \ ++ 'hosts:host:_hosts -S :' \ ++ 'devices:device:compadd -a dev_tmp' \ ++ 'directories:mount point:compadd -a mp_tmp' && ret=0 ++ ;; ++ freebsd*) ++ local _glabel while read mline; do case $mline[(w)1] in \#* ) -@@ -861,8 +864,13 @@ +@@ -833,6 +860,16 @@ devordir) + ;; + esac + done < /etc/fstab ++ # ++ /sbin/ggatel list | while read mline; do ++ dev_tmp+=(/dev/$mline) ++ done ++ ++ # add glabel devices ++ _glabel=(${(M)${(f)"$(/sbin/glabel list)"}:#*Name:[[:space:]]*/*}) ++ for mline ($_glabel);do ++ dev_tmp+=( mline[(w)3] ) ++ done + + _alternative \ + 'hosts:host:_hosts -S :' \ +@@ -859,6 +896,12 @@ udevordir) + dev_tmp=( "${(@)${(@)tmp%% *}:#none}" ) + mp_tmp=( "${(@)${(@)tmp#* }%% *}" ) ;; ++ freebsd*|dragonfly*) ++ /sbin/mount | while read mline; do ++ dev_tmp+=( $mline[(w)1] ) ++ mp_tmp+=( $mline[(w)3] ) ++ done ++ ;; *) /sbin/mount | while read mline; do -- mp_tmp+=( $mline[(w)1] ) -- dev_tmp+=( $mline[(w)3] ) -+ if [[ "$OSTYPE" =~ .*freebsd.* ]]; then -+ dev_tmp+=( $mline[(w)1] ) -+ mp_tmp+=( $mline[(w)3] ) -+ else -+ mp_tmp+=( $mline[(w)1] ) -+ dev_tmp+=( $mline[(w)3] ) -+ fi - done - ;; - esac + mp_tmp+=( $mline[(w)1] ) diff --git a/shells/zsh/files/patch-Completion-Unix-Type-_file_systems b/shells/zsh/files/patch-Completion-Unix-Type-_file_systems index 9061e6c7084a..99171b9bdc75 100644 --- a/shells/zsh/files/patch-Completion-Unix-Type-_file_systems +++ b/shells/zsh/files/patch-Completion-Unix-Type-_file_systems @@ -1,15 +1,19 @@ ---- Completion/Unix/Type/_file_systems.orig 2007-09-27 14:00:03.000000000 +0200 -+++ Completion/Unix/Type/_file_systems 2008-10-29 15:20:52.099580070 +0100 -@@ -16,7 +16,11 @@ +--- Completion/Unix/Type/_file_systems ++++ Completion/Unix/Type/_file_systems +@@ -16,10 +16,15 @@ case $OSTYPE in ;; osf*) fss=( advfs ufs nfs mfs cdfs ) ;; solaris*) fss=( ufs nfs hsfs s5fs pcfs cachefs tmpfs ) ;; - freebsd*|dragonfly*) -+ freebsd*) -+ fss=( cd9660 devfs ext2fs fdesc kernfs linprocfs mfs msdosfs nfs -+ ntfs nullfs nwfs portal procfs smbfs std udf ufs umap unionfs ) -+ ;; + dragonfly*) fss=( cd9660 devfs ext2fs fdesc kernfs linprocfs mfs msdos nfs ntfs null nwfs portal procfs std udf ufs umap union ) ;; ++ freebsd*) ++ fss=( cd9660 devfs ext2fs fdesc kernfs linprocfs mfs msdosfs nfs ++ ntfs nullfs nwfs portal procfs smbfs std udf ufs umap unionfs ++ reiserfs xfs) ++ ;; + darwin*) + fss=( afp cd9660 cddafs devfs fdesc hfs lfs msdos nfs + ntfs smbfs synthfs udf ufs volfs webdav ) diff --git a/shells/zsh/files/patch-Completion-Unix-Type-_zfs_dataset b/shells/zsh/files/patch-Completion-Unix-Type-_zfs_dataset new file mode 100644 index 000000000000..4b59be90f50c --- /dev/null +++ b/shells/zsh/files/patch-Completion-Unix-Type-_zfs_dataset @@ -0,0 +1,27 @@ +--- ./Completion/Unix/Type/_zfs_dataset.orig 2009-06-09 10:49:20.305960368 +0000 ++++ ./Completion/Unix/Type/_zfs_dataset 2009-06-09 10:50:24.299466247 +0000 +@@ -9,7 +9,23 @@ + [[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot ) + [[ -n $typearg ]] && typearg=( -t ${(j:,:)typearg} ) + +-datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} ) ++case "$OSTYPE" in ++ freebsd*) ++ local -i osreldate ++ osreldate=${${(f)"$(/sbin/sysctl kern.osreldate)"}[(w)2]} ++ if (( $osreldate >= 702102 ));then ++ datasetlist=( ${="$(zfs list -H -o name ${typearg:--t all})":#no datasets available} ) ++ else ++ datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} ) ++ fi ++ ;; ++ netbsd*) ++ datasetlist=( ${="$(zfs list -H -o name ${typearg:--t all})":#no datasets available} ) ++ ;; ++ *) ++ datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} ) ++ ;; ++esac + + expl_type=${typearg[2,-1]//,/\/} + if [[ -n $type[(r)mtpt] ]]; then |