Skip to content

Commit

Permalink
Remap option -d to -n & merge -w into -v
Browse files Browse the repository at this point in the history
  • Loading branch information
Silejonu authored Mar 14, 2022
1 parent c06106d commit 74775bd
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions kkae
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
kkae_version='v1.1'
kkae_version='1.1'

# Needed for macOS compatibility
export LC_ALL=C
Expand Down Expand Up @@ -35,14 +35,13 @@ Generate a random password and save it into the clipboard.
-c CASE Only include lowercase or uppercase letters.
-a Only include alphanumerical characters.
-s Include normally ignored similar characters (${similar_characters}).
-e 'LIST' String (in single quotes) or file with excluded characters.
-e 'LIST' String (in single quotes) or path to file with excluded characters.
-r MIN-MAX Percentage range of special characters (default is ${min_special_characters_ratio}-${max_special_characters_ratio}).
-m Save the password into the middle-click clipboard.
-d Do not send a notification when the password has been saved.
-n Do not send a notification when the password has been saved.
-p Print the password instead of saving it into the clipboard.
-w Show current settings and exit.
-v Show current settings and exit.
-b Enable debug mode.
-v Print the version number and exit.
-h Print these instructions and exit.
EOF
}
Expand All @@ -65,7 +64,7 @@ if [[ -f /etc/kkae.conf ]] ; then
fi

# Parse the command-line options
while getopts l:c:ase:r:mdpwbvh option ; do
while getopts l:c:ase:r:mnpvbh option ; do
case ${option} in
l) password_length="${OPTARG}"
valid_number='^[0-9]+$'
Expand Down Expand Up @@ -106,11 +105,10 @@ while getopts l:c:ase:r:mdpwbvh option ; do
exit 1
fi ;;
m) middle_click_clipboard='true' ;;
d) do_not_notify='true' ;;
n) do_not_notify='true' ;;
p) print_password='true' ;;
w) print_current_settings='true' ;;
v) print_current_settings='true' ;;
b) debug='true' ;;
v) printf "%s\n" "${kkae_version}" && exit 0 ;;
h) usage && exit 0 ;;
*) usage && exit 1 ;;
esac
Expand Down Expand Up @@ -157,7 +155,7 @@ fi

if [[ ${print_current_settings} = 'true' ]] ; then
cat << EOF
$(tput bold)Current kkae settings$(tput sgr0)
$(tput bold)kkae v${kkae_version}$(tput sgr0)
$(tput bold)Options passed in the terminal overwrite settings from /etc/kkae.conf$(tput sgr0)
$(tput bold)Password length:$(tput sgr0) ${password_length}
$(tput bold)Valid characters:$(tput sgr0) ${valid_characters}
Expand Down

0 comments on commit 74775bd

Please sign in to comment.