dotfiles.git

commit cf9c0bd495825f899156df395a46afb60d915e28

Author: Adam <git@apiote.xyz>

add pass script

 .local/bin/pass | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++


diff --git a/.local/bin/pass b/.local/bin/pass
new file mode 100644
index 0000000000000000000000000000000000000000..67f3c360eb102dc4a0dcbe4c057496a2da96714a
--- /dev/null
+++ b/.local/bin/pass
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+export POSIXLY_CORRECT="true"
+
+case "$1" in
+	'sync')
+		shift
+		force=""
+		TEMP=$(getopt -n 'pass sync' -o 'f' -- "$@")
+		if [ $? -ne 0 ]
+		then
+			echo 'error parsing args'
+			exit 1
+		fi
+		eval set -- "$TEMP"
+		unset TEMP
+		while true
+		do
+			case "$1" in
+				'-f')
+					force='true'
+					shift
+					continue
+					;;
+				'--')
+					shift
+					break
+					;;
+			esac
+		done
+
+		cd ~/.local/share/eeze/ || (echo 'no eeze data dir'; exit 1)
+		echo 'pulling changes'
+		git pull
+		echo 'pushing changes'
+		git push
+		if [ -n "$force" ]
+		then
+			eeze -Ir
+		fi
+		;;
+	'new')
+		shift
+		opts_def='-sy'
+		num_def='20'
+		TEMP=$(getopt -n 'pass new' -o '01AaBcCNnHhsvy' -- "$@")
+		if [ $? -ne 0 ]
+		then
+			echo 'error parsing args'
+			exit 1
+		fi
+		eval set -- "$TEMP"
+		unset TEMP
+		while true
+		do
+			case "$1" in
+				'--')
+					shift
+					break
+					;;
+				*)
+					opts="$opts $1"
+					;;
+			esac
+		done
+		num="$1"
+
+		[ -z "$opts" ] && opts=$opts_def
+		[ -z "$num" ] && num=$num_def
+
+		echo '# adding to store'
+		pwgen $opts "$num" 1 | eeze-add
+
+		echo '# syncing Joe Black'
+		cd ~/Code/current/joeblack || exit 1
+		./encode
+		;;
+	*)
+		echo 'pass (sync|new) [options]'
+		;;
+esac