mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-10-02 16:03:47 +02: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:
1 parent
9bf19603d3
commit
5f90781783
1 file changed
+11
-5
@@ -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"
|
||||
Reference in new issue
Block a user