]> git.madduck.net Git - etc/zsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

add idiotheke download script
authormartin f. krafft <madduck@madduck.net>
Mon, 15 Jan 2018 21:07:47 +0000 (10:07 +1300)
committermartin f. krafft <madduck@madduck.net>
Mon, 15 Jan 2018 21:07:47 +0000 (10:07 +1300)
.gitignore.d/zsh
.zsh/func/idiotheke [new file with mode: 0755]

index ef3e74172af9c55caadbc9b9d039a83339eaed93..54fe9b9c4f04c375b39cfe3061cfbc3d7a57a7c0 100644 (file)
@@ -1,9 +1,6 @@
 *
 *
-!/.var
-!/.var/zsh
+!/.gitignore.d/zsh
 !/.var/zsh/.gitignore
 !/.var/zsh/.gitignore
-!/.zsh
-!/.zsh/aliases
 !/.zsh/aliases/bofh
 !/.zsh/aliases/chp
 !/.zsh/aliases/curl
 !/.zsh/aliases/bofh
 !/.zsh/aliases/chp
 !/.zsh/aliases/curl
 !/.zsh/aliases/px
 !/.zsh/aliases/Q
 !/.zsh/aliases/rrsh
 !/.zsh/aliases/px
 !/.zsh/aliases/Q
 !/.zsh/aliases/rrsh
+!/.zsh/aliases/uc
 !/.zsh/aliases/w3m
 !/.zsh/aliases/wget
 !/.zsh/aliases/zstyle
 !/.zsh/dircolors
 !/.zsh/aliases/w3m
 !/.zsh/aliases/wget
 !/.zsh/aliases/zstyle
 !/.zsh/dircolors
-!/.zsh/dirhashes
 !/.zsh/dirhashes/debs
 !/.zsh/dirhashes/doc
 !/.zsh/dirhashes/log
 !/.zshenv
 !/.zsh/dirhashes/debs
 !/.zsh/dirhashes/doc
 !/.zsh/dirhashes/log
 !/.zshenv
-!/.zsh/func
 !/.zsh/func/gitpub
 !/.zsh/func/giturl
 !/.zsh/func/gitpub
 !/.zsh/func/giturl
+!/.zsh/func/idiotheke
 !/.zsh/func/old-getpw
 !/.zsh/func/p
 !/.zsh/func/svngit
 !/.zsh/func/old-getpw
 !/.zsh/func/p
 !/.zsh/func/svngit
 !/.zsh/oh-my-zsh
 !/.zsh/rcsstub
 !/.zsh/sourcedir
 !/.zsh/oh-my-zsh
 !/.zsh/rcsstub
 !/.zsh/sourcedir
-!/.zsh/themes
 !/.zsh/themes/prompt_madduck_setup
 !/.zsh/util
 !/.zsh/themes/prompt_madduck_setup
 !/.zsh/util
-!/.zsh/zlogin
 !/.zsh/.zlogin
 !/.zsh/zlogin/00-reset_shlvl_to_1
 !/.zsh/zlogin/.gitignore
 !/.zsh/.zlogin
 !/.zsh/zlogin/00-reset_shlvl_to_1
 !/.zsh/zlogin/.gitignore
-!/.zsh/zlogout
 !/.zsh/.zlogout
 !/.zsh/zlogout/00-clear_sudo_cache
 !/.zsh/zlogout/99-clear_screen
 !/.zsh/zlogout/.gitignore
 !/.zsh/.zlogout
 !/.zsh/zlogout/00-clear_sudo_cache
 !/.zsh/zlogout/99-clear_screen
 !/.zsh/zlogout/.gitignore
-!/.zsh/zprofile
 !/.zsh/.zprofile
 !/.zsh/zprofile/00-disable-core-dumps
 !/.zsh/zprofile/10-locales
 !/.zsh/zprofile/10-umask
 !/.zsh/zprofile/.gitignore
 !/.zsh/.zprofile
 !/.zsh/zprofile/00-disable-core-dumps
 !/.zsh/zprofile/10-locales
 !/.zsh/zprofile/10-umask
 !/.zsh/zprofile/.gitignore
-!/.zsh/zshenv
 !/.zsh/.zshenv
 !/.zsh/zshenv/00-apath
 !/.zsh/zshenv/00-dhpath
 !/.zsh/.zshenv
 !/.zsh/zshenv/00-apath
 !/.zsh/zshenv/00-dhpath
@@ -75,7 +67,6 @@
 !/.zsh/zshenv/00-tmpdir
 !/.zsh/zshenv/00-zvardir
 !/.zsh/zshenv/.gitignore
 !/.zsh/zshenv/00-tmpdir
 !/.zsh/zshenv/00-zvardir
 !/.zsh/zshenv/.gitignore
-!/.zsh/zshrc
 !/.zsh/.zshrc
 !/.zsh/zshrc/00-autoload_executables_in_fpath
 !/.zsh/zshrc/01-background_job_options
 !/.zsh/.zshrc
 !/.zsh/zshrc/00-autoload_executables_in_fpath
 !/.zsh/zshrc/01-background_job_options
 !/.zsh/zshrc/83-reporttime
 !/.zsh/zshrc/85-direnv
 !/.zsh/zshrc/85-mime-integration
 !/.zsh/zshrc/83-reporttime
 !/.zsh/zshrc/85-direnv
 !/.zsh/zshrc/85-mime-integration
-!/.zsh/zshrc/90_cleanfiles.disabled
 !/.zsh/zshrc/90-ls_on_chdir
 !/.zsh/zshrc/90-run-help
 !/.zsh/zshrc/95-watch-users
 !/.zsh/zshrc/90-ls_on_chdir
 !/.zsh/zshrc/90-run-help
 !/.zsh/zshrc/95-watch-users
diff --git a/.zsh/func/idiotheke b/.zsh/func/idiotheke
new file mode 100755 (executable)
index 0000000..5a0d5d6
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+set -u
+
+if [ -n "${ZSH_VERSION:-}" ]; then
+  # don't execute trap on return from functions
+  setopt local_options posix_traps no_warn_create_global
+fi
+
+RESOURCE=idiotheke.de
+PASSWORD="$(pass $RESOURCE)"
+LOGIN="$(echo "$PASSWORD" | sed -rne 's/login: //p')"
+URL="$(echo "$PASSWORD" | sed -rne 's/url: //p')"
+PASSWORD="${PASSWORD%%
+*}" #first line only
+
+if [ -n "${1:-}" ]; then
+  ASKPASS="$(tempfile --prefix=askpass --mode=700)"
+  cleanup() { rm -f $ASKPASS; trap - 0; }
+  trap cleanup 0
+
+  echo '#!/bin/sh' >> $ASKPASS
+  echo "echo ${LOGIN}:${PASSWORD}" >> $ASKPASS
+
+  wget --continue --use-askpass="$ASKPASS" "$@"
+
+  cleanup
+  ! command -v unfunction >/dev/null || unfunction cleanup
+else
+  LFTP_PASSWORD="$PASSWORD" lftp -e "open -u $LOGIN --env-password $URL"
+fi
+
+unset RESOURCE LOGIN PASSWORD URL ASKPASS