1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
# (C) 2010 magicant
# Completion script for the "ulimit" built-in command.
function completion/ulimit {
typeset OPTIONS ARGOPT PREFIX
OPTIONS=( #>#
"H --hard; set or print the hard limit"
"S --soft; set or print the soft limit"
"a --all; print all resource types with the current limits"
"--help"
) #<#
typeset limits="$(command -b ulimit -a 2>/dev/null)"
case $limits in (*'-c: '*)
OPTIONS=("$OPTIONS" #>#
"c --core; maximum size of core files in 512-byte blocks"
) #<#
esac
case $limits in (*'-d: '*)
OPTIONS=("$OPTIONS" #>#
"d --data; maximum size of a process's data segment in kilobytes"
) #<#
esac
case $limits in (*'-e: '*)
OPTIONS=("$OPTIONS" #>#
"e --nice; maximum scheduling priority (nice value)"
) #<#
esac
case $limits in (*'-f: '*)
OPTIONS=("$OPTIONS" #>#
"f --fsize; maximum size of files created by a process in 512-byte blocks"
) #<#
esac
case $limits in (*'-i: '*)
OPTIONS=("$OPTIONS" #>#
"i --sigpending; maximum number of pending signals"
) #<#
esac
case $limits in (*'-l: '*)
OPTIONS=("$OPTIONS" #>#
"l --memlock; maximum memory size that can be locked into RAM (in kilobytes)"
) #<#
esac
case $limits in (*'-m: '*)
OPTIONS=("$OPTIONS" #>#
"m --rss; maximum size of a process's resident set (in kilobytes)"
) #<#
esac
case $limits in (*'-n: '*)
OPTIONS=("$OPTIONS" #>#
"n --nofile; maximum file descriptor + 1"
) #<#
esac
case $limits in (*'-q: '*)
OPTIONS=("$OPTIONS" #>#
"q --msgqueue; maximum size of POSIX message queues (in bytes)"
) #<#
esac
case $limits in (*'-r: '*)
OPTIONS=("$OPTIONS" #>#
"r --rtprio; maximum real-time scheduling priority"
) #<#
esac
case $limits in (*'-s: '*)
OPTIONS=("$OPTIONS" #>#
"s --stack; maximum stack size (in kilobytes)"
) #<#
esac
case $limits in (*'-t: '*)
OPTIONS=("$OPTIONS" #>#
"t --cpu; CPU time that can be used by a process (in seconds)"
) #<#
esac
case $limits in (*'-u: '*)
OPTIONS=("$OPTIONS" #>#
"u --nproc; maximum number of processes for a user"
) #<#
esac
case $limits in (*'-v: '*)
OPTIONS=("$OPTIONS" #>#
"v --as; maximum size of memory used by a process (in kilobytes)"
) #<#
esac
case $limits in (*'-x: '*)
OPTIONS=("$OPTIONS" #>#
"x --locks; maximum number of file locks"
) #<#
esac
command -f completion//parseoptions -es
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
(*) #>>#
complete unlimited
;; #<<#
esac
}
# vim: set ft=sh ts=8 sts=8 sw=8 et:
|