summaryrefslogtreecommitdiff
path: root/home/.oh-my-zsh/plugins/qrcode
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2025-07-13 06:42:05 +0200
committernavewindre <boneyaard@gmail.com>2025-07-13 06:42:05 +0200
commit02f14a9cb152561a5e44062aac79f3b700403b40 (patch)
tree2db8ebda3b7f6f8777783aeb5c60018e6e1359d8 /home/.oh-my-zsh/plugins/qrcode
parentcbbdeb2f6b40a102a829f0c47cff052937231f00 (diff)
omz
Diffstat (limited to 'home/.oh-my-zsh/plugins/qrcode')
-rw-r--r--home/.oh-my-zsh/plugins/qrcode/README.md8
-rw-r--r--home/.oh-my-zsh/plugins/qrcode/qrcode.plugin.zsh17
2 files changed, 25 insertions, 0 deletions
diff --git a/home/.oh-my-zsh/plugins/qrcode/README.md b/home/.oh-my-zsh/plugins/qrcode/README.md
new file mode 100644
index 0000000..4428389
--- /dev/null
+++ b/home/.oh-my-zsh/plugins/qrcode/README.md
@@ -0,0 +1,8 @@
+# QRCode plugin
+
+Generate a QR Code from the command line. Uses [QRcode.show](https://qrcode.show) via curl.
+
+alias | command
+--------------- | --------
+`qrcode [text]` | `curl -d "text" qrcode.show`
+`qrsvg [text]` | `curl -d "text" qrcode.show -H "Accept: image/svg+xml"`
diff --git a/home/.oh-my-zsh/plugins/qrcode/qrcode.plugin.zsh b/home/.oh-my-zsh/plugins/qrcode/qrcode.plugin.zsh
new file mode 100644
index 0000000..d757e13
--- /dev/null
+++ b/home/.oh-my-zsh/plugins/qrcode/qrcode.plugin.zsh
@@ -0,0 +1,17 @@
+# Imported and improved from https://qrcode.show/, section SHELL FUNCTIONS
+
+_qrcode_show_message() {
+ echo "Type or paste your text, add a new blank line, and press ^d"
+}
+
+qrcode () {
+ local input="$*"
+ [ -z "$input" ] && _qrcode_show_message && local input="@/dev/stdin"
+ curl -d "$input" https://qrcode.show
+}
+
+qrsvg () {
+ local input="$*"
+ [ -z "$input" ] && _qrcode_show_message && local input="@/dev/stdin"
+ curl -d "$input" https://qrcode.show -H "Accept: image/svg+xml"
+}