develop init push
This commit is contained in:
44
gui
Executable file
44
gui
Executable file
@@ -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
|
||||
Reference in New Issue
Block a user