Add version option

You can now ask the program for its version with `bemoji -v`.
This commit is contained in:
Marty Oehme 2021-12-01 22:31:27 +01:00
parent afdfc53bfe
commit 8a31a36280
Signed by: Marty
GPG Key ID: B7538B8F50A1C800
1 changed files with 8 additions and 5 deletions

13
bemoji
View File

@ -1,9 +1,6 @@
#!/usr/bin/env bash
# Wanted features:
#
# - [ ] limit maximum number of recent emoji
bm_version=0.1
# Emoji default database location
bm_db_location=${BEMOJI_DB_LOCATION:-"${XDG_DATA_HOME:-$HOME/.local/share}/bemoji"}
# Setting custom emoji list file location:
@ -40,8 +37,13 @@ usage() {
exit "$1"
}
version() {
echo "v${bm_version}"
exit
}
# Get Options
while getopts ":f:D:tcepPh" o; do
while getopts ":f:D:tcepPhv" o; do
case "${o}" in
f) BEMOJI_CUSTOM_LIST="${OPTARG}" ;;
t) bm_default_cmd=_typeResult ;;
@ -51,6 +53,7 @@ while getopts ":f:D:tcepPh" o; do
p) bm_private_mode=true ;;
P) bm_ignore_recent=true ;;
h) usage 0 ;;
v) version ;;
*) usage 1 ;;
esac
done