diff --git a/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh b/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh index 206cfc8..5f31015 100644 --- a/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh +++ b/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # Parse arguments # ------------------------------------------------------------------------------------ @@ -186,7 +186,9 @@ send_notify() { # Obtain notifications and show them, if they weren't showed (aren't in cache) already # ------------------------------------------------------------------------------------ # Request unread notifications with gh-notify extension for github-cli +[ $VERY_VERBOSE -eq 1 ] && echo "Requesting notifications..." [ "$ALL" -eq 1 ] && out="$(gh notify -s -a -n "$MAX_AMOUNT" 2>/dev/null)" || out="$(gh notify -s -n "$MAX_AMOUNT" 2>/dev/null)" +[ $VERY_VERBOSE -eq 1 ] && echo "Notifications received" # When no notifications were found, set output to empty string, to avoid 'All caught up!' line # being treated as notification @@ -216,18 +218,18 @@ if [ "$total" -gt 0 ]; then [ $VERY_VERY_VERBOSE -eq 1 ] && echo "gh-notify output line: $line" # Parse out the data from given output lines - issue_type="$(echo "$line" | awk '{print $4}' | sed 's/\x1b\[[0-9;]*m//g')" - repo_id="$(echo "$line" | awk '{print $3}' | sed 's/\x1b\[[0-9;]*m//g')" + issue_type="$(echo "$line" | awk -F ' +' '{print $4}' | sed 's/\x1b\[[0-9;]*m//g')" + repo_id="$(echo "$line" | awk -F ' +' '{print $3}' | sed 's/\x1b\[[0-9;]*m//g')" if [ "$issue_type" == "PullRequest" ]; then - issue_id="$(echo "$line" | awk '{print $5}' | sed 's/\x1b\[[0-9;]*m//g' | cut -c2-)" - description="$(echo "$line" | awk '{for (i=6; i