feat(qrcode): new plugin to generate qrcode via https://qrcode.show (#10247)
* feat(qrcode): new plugin to generate qrcode via https://qrcode.show
* code fix suggested by @JuniorJPDJ
* Update docs to clarify how to interact with it
Co-authored-by: Robby Russell <robby@planetargon.com>
Diff
1diff --git a/plugins/qrcode/README.md b/plugins/qrcode/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..bcc87054119b2fa03ae37daeb5ab2234bba0bc4f
4--- /dev/null
5+++ b/plugins/qrcode/README.md
6@@ -0,0 +1,8 @@
7+# QRCode plugin
8+
9+Generate a QR Code from the command line. Uses [QRcode.show](https://qrcode.show) via curl.
10+
11+alias | command
12+--------------- | --------
13+`qrcode [text]` | `curl -d "text" qrcode.show`
14+`qrsvg [text]` | `curl -d "text" qrcode.show -H "Accepct: image.svg"`
15diff --git a/plugins/qrcode/qrcode.plugin.zsh b/plugins/qrcode/qrcode.plugin.zsh
16new file mode 100644
17index 0000000000000000000000000000000000000000..d757e135e4acef82f7881c0caba446787a85f5b9
18--- /dev/null
19+++ b/plugins/qrcode/qrcode.plugin.zsh
20@@ -0,0 +1,17 @@
21+# Imported and improved from https://qrcode.show/, section SHELL FUNCTIONS
22+
23+_qrcode_show_message() {
24+ echo "Type or paste your text, add a new blank line, and press ^d"
25+}
26+
27+qrcode () {
28+ local input="$*"
29+ [ -z "$input" ] && _qrcode_show_message && local input="@/dev/stdin"
30+ curl -d "$input" https://qrcode.show
31+}
32+
33+qrsvg () {
34+ local input="$*"
35+ [ -z "$input" ] && _qrcode_show_message && local input="@/dev/stdin"
36+ curl -d "$input" https://qrcode.show -H "Accept: image/svg+xml"
37+}