mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
Add some upstream completion patches + new completion files for
procstat, sockstat and fstat. Submitted by: Baptiste Daroussin <baptiste.daroussin@gmail.com>
This commit is contained in:
parent
0d049050c6
commit
186692d099
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=235876
7 changed files with 171 additions and 37 deletions
|
@ -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:
|
||||
|
|
15
shells/zsh/files/_fstat
Normal file
15
shells/zsh/files/_fstat
Normal file
|
@ -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'
|
17
shells/zsh/files/_procstat
Normal file
17
shells/zsh/files/_procstat
Normal file
|
@ -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))'
|
23
shells/zsh/files/_sockstat
Normal file
23
shells/zsh/files/_sockstat
Normal file
|
@ -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))'
|
|
@ -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] )
|
||||
|
|
|
@ -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 )
|
||||
|
|
27
shells/zsh/files/patch-Completion-Unix-Type-_zfs_dataset
Normal file
27
shells/zsh/files/patch-Completion-Unix-Type-_zfs_dataset
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue