feat(plugins): `octozen` shows an Octocat zen quote on startup (#5959)
Co-authored-by: Marc Cornellà <hello@mcornella.com>
Diff
1diff --git a/plugins/octozen/README.md b/plugins/octozen/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..2051248ca0ded3e39b0d471cc917dfffbe347aba
4--- /dev/null
5+++ b/plugins/octozen/README.md
6@@ -0,0 +1,12 @@
7+# Octozen plugin
8+
9+Displays a zen quote from GitHub's Octocat on start up.
10+
11+To use it, add `octozen` to the plugins array in your zshrc file:
12+
13+```zsh
14+plugins=(... octozen)
15+```
16+
17+It defines a `display_octozen` function that fetches a GitHub Octocat zen quote.
18+NOTE: Internet connection is required (will time out if not fetched in 2 seconds).
19diff --git a/plugins/octozen/octozen.plugin.zsh b/plugins/octozen/octozen.plugin.zsh
20new file mode 100644
21index 0000000000000000000000000000000000000000..71ee550a561e1b95aa5508cf78b45a6975704d62
22--- /dev/null
23+++ b/plugins/octozen/octozen.plugin.zsh
24@@ -0,0 +1,11 @@
25+# octozen plugin
26+
27+# Displays a zen quote from octocat
28+function display_octozen() {
29+ curl -m 2 -fsL "https://api.github.com/octocat"
30+ add-zsh-hook -d precmd display_octozen
31+}
32+
33+# Display the octocat on the first precmd, after the whole starting process has finished
34+autoload -Uz add-zsh-hook
35+add-zsh-hook precmd display_octozen