]> 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:

retire old-getpw
authormartin f. krafft <madduck@madduck.net>
Sat, 2 Nov 2019 07:45:08 +0000 (20:45 +1300)
committermartin f. krafft <madduck@madduck.net>
Sat, 2 Nov 2019 07:45:08 +0000 (20:45 +1300)
.zsh/func/old-getpw [deleted file]

diff --git a/.zsh/func/old-getpw b/.zsh/func/old-getpw
deleted file mode 100755 (executable)
index 4bdb401..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/sh
-#
-# func/getpw
-#
-# obtain a password from ~/pw.gpg
-#
-# Copyright © 2011 martin f. krafft <madduck@madduck.net>
-# Released under the terms of the Artistic Licence 2.0
-#
-# Source repository: http://git.madduck.net/v/etc/zsh.git
-#
-
-local PWENCFILE=${HOME}/pw.gpg
-local incother=0
-local dest clip=1
-[ -x $(command -v xclip) ] || clip=0
-
-OPTIND=0
-while getopts :po opt; do
-  case "$opt" in
-    \?) echo >&2 "E: unrecognised option: -$OPTARG"; return 1;;
-     p) clip=0;;
-     o) incother=1;;
-  esac
-done
-(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
-
-if [[ $clip = 1 ]]; then
-  dest='tr -d \\n | xclip -in'
-else
-  dest="column -ts'    '"
-fi
-
-if (( $# == 1 )); then
-  case "$1" in
-    *@*) local identity="${1%@*}"
-         local resource="${1##*@}"
-         ;;
-    *) local resource="$1";;
-  esac
-else
-  local resource="$1"
-  local identity="$2"
-fi
-
-local IFSOLD="$IFS"; IFS="     "
-local output
-gpg --decrypt --quiet "$PWENCFILE" | \
-  {
-    output=$(while read r i p o; do
-      case "$r:l/$i:l" in
-        (*${resource:l}*/${identity:+*${identity:l}}*)
-          echo "'$r'   '$i'    '$p'    '$o'";;
-      esac
-    done)
-  }
-[ -z "$output" ] && return 1
-
-typeset -al results
-results=(${(f)output})
-
-typeset -al result
-if (( ${#results} == 1 )); then
-  result=(${(z)${results[1]}})
-  output="${result[3]}"
-  [[ $incother = 1 ]] && output="$output ${result[4]}"
-  eval echo "$output" | eval $dest
-  [[ $clip = 1 ]] && eval echo >&2 "match for ${result[1]}, ID ${result[2]} put onto X clipboard."
-else
-  if [[ $clip = 1 ]]; then
-    echo >&2 "E: multiple matches, hence not putting onto clipboard; use -p option."
-    return 1
-  fi
-  for r in $results; do
-    result=(${(z)r})
-    output="${result[2]}@${result[1]}  ${result[3]}"
-    [[ $incother = 1 ]] && output="$output ${result[4]}"
-    echo "$output"
-  done | eval $dest
-fi
-
-IFS="$IFSOLD"