mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-23 14:42:52 +08:00
plugins/chucknorris: Add automatic updating of the compiled fortune data file. Use local variable for readability, and anonymous function to provide a scope for the local variable.
This commit is contained in:
parent
9bf19603d3
commit
5f90781783
|
@ -1,6 +1,12 @@
|
|||
if [ ! -f $ZSH/plugins/chucknorris/fortunes/chucknorris.dat ]; then
|
||||
strfile $ZSH/plugins/chucknorris/fortunes/chucknorris $ZSH/plugins/chucknorris/fortunes/chucknorris.dat
|
||||
fi
|
||||
() {
|
||||
# Automatically generate or update Chuck's compiled fortune data file
|
||||
local fdir=$ZSH/plugins/chucknorris/fortunes
|
||||
if [[ ! -f $fdir/chucknorris.dat ]] || [[ $fdir/chucknorris.dat -ot $fdir/chucknorris ]]; then
|
||||
strfile $fdir/chucknorris $fdir/chucknorris.dat
|
||||
fi
|
||||
|
||||
# Aliases
|
||||
alias chuck="fortune -a $fdir"
|
||||
alias chuck_cow="chuck | cowthink"
|
||||
}
|
||||
|
||||
alias chuck="fortune -a $ZSH/plugins/chucknorris/fortunes"
|
||||
alias chuck_cow="chuck | cowthink"
|
||||
|
|
Loading…
Reference in New Issue
Block a user