X-Git-Url: https://git.armaanb.net/?p=charsel.git;a=blobdiff_plain;f=charsel;fp=charsel;h=7938a1c251847e106e55ddad6a63fb33b6b75242;hp=d7deba7801b2c9adc87817316c33e8e6b4488244;hb=ff5fb4bfda8a49feba0d9cd2f74e4b3b5524e779;hpb=59f9d833f1091dc4a42da9f1f745bd95672553ae diff --git a/charsel b/charsel index d7deba7..7938a1c 100755 --- a/charsel +++ b/charsel @@ -19,7 +19,7 @@ ######################################################################## -VERSION=2.0.7 +VERSION=2.0.8 # Define argument functions function usage() { @@ -33,7 +33,8 @@ A simple terminal character selector -L show installed charfiles without the message -l show installed charfiles -n dont copy character to clipboard, avoids Xclip dependency - -v print version + -V check for updates + -v print current version Exit status: 0 okay, @@ -43,6 +44,18 @@ Exit status: 4 other error" } +function version_check(){ + NEW_VERSION=$(curl -s https://codeberg.org/armaan/charsel/raw/branch/master/charsel \ + | grep VERSION= | tail -c +9) + if [[ $VERSION != $NEW_VERSION ]] + then + echo "an update is available" + else + echo "you are up to date" + fi + +} + CHARDIR=$HOME/.cache/charsel function list() { ls $CHARDIR/charfiles @@ -106,7 +119,7 @@ function validity() { } # Look for arguments -while getopts ":abcdhlLnv" arg +while getopts ":abcdhlLnvV" arg do case ${arg} in a) @@ -143,6 +156,10 @@ do echo "charsel" $VERSION exit 0 ;; + V) + version_check + exit 0 + ;; ?) echo "Invalid option" usage