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
d8b3e115
Unverified
Commit
d8b3e115
authored
May 25, 2016
by
Luiz Pericolo
Committed by
Marc Cornellà
Mar 27, 2021
Browse files
feat(plugins): add hitchhiker plugin (#5117)
parent
02d07f3e
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
plugins/hitchhiker/.gitignore
0 → 100644
View file @
d8b3e115
fortunes/hitchhiker.dat
plugins/hitchhiker/README.md
0 → 100644
View file @
d8b3e115
# hitchhiker
This plugin adds quotes from The Hitchhiker's Guide to the Galaxy, from Douglas Adams.
To use it, add
`hitchhiker`
to the plugins array in your zshrc file:
```
zsh
plugins
=(
... hitchhiker
)
```
## Aliases
-
`hitchhiker`
: displays a quote from the book using
`fortune`
.
-
`hitchhiker_cow`
: displays a quote from the book using
`cowthink`
.
```
console
$
hitchhiker_cow
_______________________________________
( "OK, so ten out of ten for style, but )
( minus several million for good )
( thinking, yeah? " )
---------------------------------------
o ^__^
o (oo)\_______
(__)\ )\/\
||----w |
|| ||
```
## Requirements
-
`fortune`
and
`strfile`
.
-
`cowthink`
if using the
`hitchhiker_cow`
command.
## Credits
Fortune file: Andreas Gohr
<andi@splitbrain.org>
(
[
splitbrain.org
](
https://www.splitbrain.org/projects/fortunes/hg2g
)
)
Spelling and formatting fixes: grok@resist.ca
Original quotes from:
-
https://web.archive.org/web/20120106083254/http://tatooine.fortunecity.com/vonnegut/29/hitch/parhaat.html
-
https://web.archive.org/web/20011112065737/http://www-personal.umd.umich.edu/~nhughes/dna/faqs/quotedir.html
plugins/hitchhiker/fortunes/hitchhiker
0 → 100644
View file @
d8b3e115
This diff is collapsed.
Click to expand it.
plugins/hitchhiker/hitchhiker.plugin.zsh
0 → 100644
View file @
d8b3e115
HITCHHIKER_DIR
=
"
${
0
:h
}
/fortunes"
# Aliases
alias
hitchhiker
=
"fortune -a
$HITCHHIKER_DIR
"
alias
hitchhiker_cow
=
"hitchhiker | cowthink"
()
{
# Don't generate hitchhiker.dat if it exists and is up-to-date
if
[[
-f
"
$HITCHHIKER_DIR
/hitchhiker.dat"
]]
&&
!
[[
"
$HITCHHIKER_DIR
/hitchhiker.dat"
-ot
"
$HITCHHIKER_DIR
/hitchhiker"
]]
;
then
return
fi
# If strfile is not found: some systems install strfile in /usr/sbin but it's not in $PATH
if
!
command
-v
strfile &>/dev/null
&&
!
[[
-f
/usr/sbin/strfile
]]
;
then
echo
"[oh-my-zsh] hitchhiker depends on strfile, which is not installed"
>
&2
echo
"[oh-my-zsh] strfile is often provided as part of the 'fortune' package"
>
&2
return
fi
"
${
commands
[strfile]
:-
/usr/sbin/strfile
}
"
"
$HITCHHIKER_DIR
/hitchhiker"
"
$HITCHHIKER_DIR
/hitchhiker.dat"
>
/dev/null
}
unset
HITCHHIKER_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