summaryrefslogtreecommitdiff
path: root/angou
diff options
context:
space:
mode:
Diffstat (limited to 'angou')
-rwxr-xr-xangou11
1 files changed, 10 insertions, 1 deletions
diff --git a/angou b/angou
index 845670b..c1d06fc 100755
--- a/angou
+++ b/angou
@@ -6,6 +6,9 @@ ANGOU_DIR=${ANGOU_DIR:-"$HOME/.angou/"}
6ANGOU_CLIPBOARD=${ANGOU_CLIPBOARD:-"xsel -i"} 6ANGOU_CLIPBOARD=${ANGOU_CLIPBOARD:-"xsel -i"}
7# sets command to use when listing directory structure 7# sets command to use when listing directory structure
8ANGOU_LIST=${ANGOU_LIST:-"tree"} 8ANGOU_LIST=${ANGOU_LIST:-"tree"}
9# custom command for generating passwords/users
10ANGOU_GEN_PASS=${ANGOU_GEN_PASS:-"random pass"}
11ANGOU_GEN_USER=${ANGOU_GEN_USER:-"random user"}
9 12
10mkdir -p "$ANGOU_DIR" 13mkdir -p "$ANGOU_DIR"
11cd "$ANGOU_DIR" || exit 14cd "$ANGOU_DIR" || exit
@@ -35,6 +38,11 @@ edit() {
35 38
36 tmpfile="$(mktemp)" 39 tmpfile="$(mktemp)"
37 40
41 if [ "$2" = "generate" ]; then
42 $ANGOU_GEN_PASS >"$tmpfile"
43 echo "Username: $($ANGOU_GEN_USER)" >>"$tmpfile"
44 fi
45
38 # edit a copy of a password if it already exists 46 # edit a copy of a password if it already exists
39 [ -f "$1" ] && $ANGOU_DECRYPT "$1" > "$tmpfile" 47 [ -f "$1" ] && $ANGOU_DECRYPT "$1" > "$tmpfile"
40 48
@@ -46,7 +54,7 @@ edit() {
46 54
47# print usage 55# print usage
48usage() { 56usage() {
49 printf "Usage: %s [help|copy|edit|view [file or directory]]\n" "$0" 57 printf "Usage: %s [help|copy|edit|generate|view [file or directory]]\n" "$0"
50 printf "\tThe edit and copy command expects a file as an argument,\n" 58 printf "\tThe edit and copy command expects a file as an argument,\n"
51 printf "\twhile the view command expects a directory as an argument.\n" 59 printf "\twhile the view command expects a directory as an argument.\n"
52 printf "\tThe arguments for view and edit are relative to\n" 60 printf "\tThe arguments for view and edit are relative to\n"
@@ -61,6 +69,7 @@ case "$option" in
61 help) usage ;; 69 help) usage ;;
62 copy) copy "$2" ;; 70 copy) copy "$2" ;;
63 edit) edit "$2" ;; 71 edit) edit "$2" ;;
72 generate) edit "$2" generate ;;
64 view) view "$2" ;; 73 view) view "$2" ;;
65 *) view "$1" ;; 74 *) view "$1" ;;
66esac 75esac