mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
[Fix #60] Do not use parentheses in function names
This commit is contained in:
parent
a3b92bb053
commit
6a9a4ea8d6
22 changed files with 66 additions and 67 deletions
10
helper.zsh
10
helper.zsh
|
|
@ -6,17 +6,17 @@
|
|||
#
|
||||
|
||||
# Checks if a file can be autoloaded by trying to load it in a subshell.
|
||||
function autoloadable() {
|
||||
function autoloadable {
|
||||
( unfunction $1 ; autoload -U +X $1 ) &> /dev/null
|
||||
}
|
||||
|
||||
# Checks boolean variable for "true" (case insensitive "1", "y", "yes", "t", "true", "o", and "on").
|
||||
function is-true() {
|
||||
function is-true {
|
||||
[[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]]
|
||||
}
|
||||
|
||||
# Prints the first non-empty string in the arguments array.
|
||||
function coalesce() {
|
||||
function coalesce {
|
||||
for arg in $argv; do
|
||||
print "$arg"
|
||||
return 0
|
||||
|
|
@ -33,7 +33,7 @@ TRAP_SIGNALS=(
|
|||
)
|
||||
|
||||
# Adds a function to a list to be called when a trap is triggered.
|
||||
function add-zsh-trap() {
|
||||
function add-zsh-trap {
|
||||
if (( $# < 2 )); then
|
||||
print "usage: $0 type function" >&2
|
||||
return 1
|
||||
|
|
@ -52,7 +52,7 @@ function add-zsh-trap() {
|
|||
|
||||
if (( ! $+functions[TRAP${1}] )); then
|
||||
eval "
|
||||
function TRAP${1}() {
|
||||
function TRAP${1} {
|
||||
for trap_function in \"\$TRAP${1}_FUNCTIONS[@]\"; do
|
||||
if (( \$+functions[\$trap_function] )); then
|
||||
\"\$trap_function\" \"\$1\"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue