shell formatting

This commit is contained in:
Daylin Morgan 2022-06-15 14:28:16 -05:00
parent 5faafce31c
commit 627d00c94a
3 changed files with 47 additions and 40 deletions

View file

@ -12,7 +12,6 @@ HELP
exit 0
}
updates_output() {
notify=$1
if ! [[ -z $updates_arch ]]; then
@ -20,11 +19,16 @@ updates_output() {
[[ -z $notify ]] && echo "$updates_arch"
fi
if ! [[ -z $updates_aur ]]; then
echo "AUR:"
echo "AUR: $(echo "$updates_aur" | wc -l)"
[[ -z $notify ]] && echo "$updates_aur"
fi
echo
}
update_system() {
read -p "Would you like to update? (y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
pikaur -Syu
}
for opt in "$@"; do
case $opt in
@ -43,17 +47,21 @@ for opt in "$@"; do
esac
done
echo "fetching updates..."
updates_arch="$(checkupdates 2>/dev/null | awk '{print $1}')"
updates_aur="$(pikaur -Qua 2>/dev/null | awk '{print $1}')"
updates_info="$(updates_output $notify)"
if [[ -z $updates_info ]]; then
echo "system up to date"
exit 0
fi
if ! [[ -z $notify ]]; then
notify-send -t 60000 "System Updates Available!" "$updates_info"
notify-send -w "System Updates Available!" "$updates_info"
else
echo "System Updates Available!"
echo "$updates_info"
update_system
fi

View file

@ -43,9 +43,9 @@ make_figlet() {
}
font_size=25
font_to_px=$(( $font_size * 16 / 12 ))
greeter_h=$(($(make_figlet | wc -l) * $font_to_px))
greeter_w=$(($(make_figlet | wc -L ) * $font_to_px))
font_to_px=$((font_size * 16 / 12))
greeter_h=$(($(make_figlet | wc -l) * font_to_px))
greeter_w=$(($(make_figlet | wc -L) * font_to_px))
greeter_pos="x+w/2-${greeter_w}/4:y+h/2-${greeter_h}/4"
@ -83,8 +83,7 @@ i3lock \
--greeter-size $font_size \
--greeter-color $cyan \
--greeter-pos "${greeter_pos}" \
--greeter-align 1 \
--greeter-align 1
# resume message display
pkill -u "$USER" -USR2 dunst

View file

@ -106,7 +106,7 @@ list() {
user_len=$(yq e '.[] | .user ' $YAMLDOC | tail -n +2 | sort | uniq | awk '{print length}' | sort -nr | head -n 1)
tool_len=$(yq e 'keys| .[]' $YAMLDOC | tail -n +2 | sort | uniq | awk '{print length}' | sort -nr | head -n 1)
table_width=$(($user_len + $tool_len + 25))
table_width=$((user_len + tool_len + 25))
tool_cell=$(printf "%${tool_len}s" "")
user_cell=$(printf "%${user_len}s" "")
@ -125,11 +125,11 @@ ${CYAN} install date${NORMAL}\n" \
user=$(key=$tool yq e 'explode(.) | .[env(key)].user' $YAMLDOC)
bin_name=$(key=$tool yq e 'explode(.) | .[env(key)].to' $YAMLDOC)
[[ "$bin_name" == "null" ]] && bin_name=$tool
[[ $bin_name == "null" ]] && bin_name=$tool
modified=$(check_install $bin_name)
! [[ -z "$modified" ]] && installed=$INSTALL_YES || installed=$INSTALL_NO
! [[ -z $modified ]] && installed=$INSTALL_YES || installed=$INSTALL_NO
printf \
"${MAGENTA}%s${NORMAL}%s | \