mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Added conditional stat to cake plugin to work cross-platform
This commit is contained in:
parent
d165a84dc0
commit
fe7134e94b
1 changed files with 9 additions and 3 deletions
|
|
@ -1,3 +1,9 @@
|
||||||
|
stat -f%m . > /dev/null 2>&1
|
||||||
|
if [ "$?" = 0 ]; then
|
||||||
|
stat_cmd=(stat -f%m)
|
||||||
|
else
|
||||||
|
stat_cmd=(stat -L --format=%y)
|
||||||
|
fi
|
||||||
# Set this to 1 if you want to cache the tasks
|
# Set this to 1 if you want to cache the tasks
|
||||||
_cake_cache_task_list=1
|
_cake_cache_task_list=1
|
||||||
|
|
||||||
|
|
@ -16,8 +22,8 @@ _cake_does_target_list_need_generating () {
|
||||||
|
|
||||||
if [ ! -f ${_cake_task_cache_file} ]; then return 0;
|
if [ ! -f ${_cake_task_cache_file} ]; then return 0;
|
||||||
else
|
else
|
||||||
accurate=$(stat -f%m $_cake_task_cache_file)
|
accurate=$($stat_cmd $_cake_task_cache_file)
|
||||||
changed=$(stat -f%m Cakefile)
|
changed=$($stat_cmd Cakefile)
|
||||||
return $(expr $accurate '>=' $changed)
|
return $(expr $accurate '>=' $changed)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -33,4 +39,4 @@ _cake () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
compdef _cake cake
|
compdef _cake cake
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue