From 0998e78a1a9f4546ec949c5fd55536a8f16dc34b Mon Sep 17 00:00:00 2001 From: "bradley.richins" Date: Sun, 11 Oct 2020 08:11:38 -0600 Subject: [PATCH] develop init push --- gui | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 gui diff --git a/gui b/gui new file mode 100755 index 0000000..8abb598 --- /dev/null +++ b/gui @@ -0,0 +1,44 @@ +#!/bin/bash + +if ! hash zenity 2>/dev/null; then + echo "Please install zenity." + exit 127 # command not found error +fi +if ! hash convert 2>/dev/null; then + echo "Please install imagemagic." + exit 127 +fi + +zen_error () { + if [ -z "$1" ]; then + zenity --error --title="ALERT! ERROR!" --text="An unknown error has occured" + exit 1 # general error + else + if [ -z "$2" ]; then + zenity --error --title="ALERT! ERROR!" --text="$1" + exit 1 + else + zenity --error --title="ALERT! ERROR!" --text="$1" + exit $2 + fi + fi +} + +HEXGLYPH=$(zenity --entry --title="Glyph hex" --text="Enter Hex value for each glyph\n\n NOT Galactic coordinates\n\n Example: 006afa556c30\tNOT: 042f:0079:0D55:006a") +[[ "$?" != "0" ]] && zen_error "Action cancelled by user" 1 +if [ -z "$HEXGLYPH" ]; then + zen_error "No data was input" 1 +fi + +# check if len == 12 +HGLEN=${#HEXGLYPH} +if [ $HGLEN != 12 ]; then + zen_error "12 (HEX) chars are required" 1 +fi + +HEXGLYPH=${HEXGLYPH^^} # Make string uppercase +echo -e "Glyph code: \e[0;94m$HEXGLYPH\e[0m" # not necessary but nice to have + + + +exit 0