diff options
Diffstat (limited to '.local')
-rwxr-xr-x | .local/share/bin/set-default | 32 | ||||
-rwxr-xr-x | .local/share/pass-extensions/duplicates.bash | 13 | ||||
-rwxr-xr-x | .local/share/pass-extensions/g.bash | 2 |
3 files changed, 39 insertions, 8 deletions
diff --git a/.local/share/bin/set-default b/.local/share/bin/set-default new file mode 100755 index 0000000..d93f65c --- /dev/null +++ b/.local/share/bin/set-default @@ -0,0 +1,32 @@ +#!/bin/sh +SCRIPT_NAME="$(basename "$0")" + +usage() { + code=0 + if [ -z "$1" ] ; then + cat << EOF +Set desktop entry ENTRY as default application for opening files with the same +type as FILE + +EOF + else + echo "error: $1" >&2 + code=1 + fi + cat << EOF +usage: + $SCRIPT_NAME ENTRY FILE [FILE] +EOF + exit $code +} + +[ $# -eq 0 ] && usage +DESKTOP_ENTRY="$1"; shift +[ -z "$DESKTOP_ENTRY" ] && usage "no desktop entry" +[ $# -lt 1 ] && usage "no reference file(s)" + +for file in "$@" ; do + mimetype="$(xdg-mime query filetype "$file")" + xdg-mime default "$DESKTOP_ENTRY" "$mimetype" +done + diff --git a/.local/share/pass-extensions/duplicates.bash b/.local/share/pass-extensions/duplicates.bash index cb1cbbc..3ba47aa 100755 --- a/.local/share/pass-extensions/duplicates.bash +++ b/.local/share/pass-extensions/duplicates.bash @@ -5,21 +5,18 @@ pass_names="$(pass names -l)" [ $? -ne 0 ] && exit 1 pass_count="$(echo "$pass_names" | wc -l)" -if [ "$pass_count" -gt 10 ] ; then - cat << EOF >&2 -pass-duplicates needs to decrypt all your passwords one-by-one to cross-match -them. This is all done in-memory, and nothing is saved to disk. You appear to -have $pass_count passwords, so this may take some time... - -EOF -fi +pass_index=1 while read pass_name ; do hash="$(pass show "$pass_name" | head -n1 | sha1sum | cut -c1-40)" dupe_map["$pass_name"]="$hash" dupe_tally["$hash"]=$(( ${dupe_tally["$hash"]} + 1 )) + + printf '\rhashing... (%d/%d)' "$pass_index" "$pass_count" >&2 + pass_index=$(( $pass_index + 1 )) done < <(echo "$pass_names") +printf '\r\e[2K' >&2 unique_duplicates=0 total_shared=0 diff --git a/.local/share/pass-extensions/g.bash b/.local/share/pass-extensions/g.bash new file mode 100755 index 0000000..4ab3ace --- /dev/null +++ b/.local/share/pass-extensions/g.bash @@ -0,0 +1,2 @@ +#!/bin/bash +exec pass git "$@" |