Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
b05ef103
Commit
b05ef103
authored
Sep 27, 2015
by
Robby Russell
Browse files
Merge pull request #4121 from apjanke/chucknorris-check-for-fortune
chucknorris: check for fortune/strfile dependency
parents
a51a9169
a2e01e9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/chucknorris/chucknorris.plugin.zsh
View file @
b05ef103
if
[
!
-f
$ZSH
/plugins/chucknorris/fortunes/chucknorris.dat
]
;
then
# chucknorris: Chuck Norris fortunes
strfile
$ZSH
/plugins/chucknorris/fortunes/chucknorris
$ZSH
/plugins/chucknorris/fortunes/chucknorris.dat
# Automatically generate or update Chuck's compiled fortune data file
# $0 must be used outside a local function. This variable name is unlikly to collide.
CHUCKNORRIS_PLUGIN_DIR
=
${
0
:h
}
()
{
local
DIR
=
$CHUCKNORRIS_PLUGIN_DIR
/fortunes
if
[[
!
-f
$DIR
/chucknorris.dat
]]
||
[[
$DIR
/chucknorris.dat
-ot
$DIR
/chucknorris
]]
;
then
# For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default
local
strfile
=
strfile
if
!
which strfile &>/dev/null
&&
[[
-f
/usr/sbin/strfile
]]
;
then
strfile
=
/usr/sbin/strfile
fi
if
which
$strfile
&> /dev/null
;
then
$strfile
$DIR
/chucknorris
$DIR
/chucknorris.dat
>
/dev/null
else
echo
"[oh-my-zsh] chucknorris depends on strfile, which is not installed"
>
&2
echo
"[oh-my-zsh] strfile is often provided as part of the 'fortune' package"
>
&2
fi
fi
fi
alias
chuck
=
"fortune -a
$ZSH
/plugins/chucknorris/fortunes"
# Aliases
alias
chuck
=
"fortune -a
$DIR
"
alias
chuck_cow
=
"chuck | cowthink"
alias
chuck_cow
=
"chuck | cowthink"
}
unset
CHUCKNORRIS_PLUGIN_DIR
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment