diff --git a/shenanigans.sh b/shenanigans.sh index ce710213cc1798797f524c12f07757d7e0d577e4..e6a210a5cbbf3d03cd36c51cd2602656ae62273d 100755 --- a/shenanigans.sh +++ b/shenanigans.sh @@ -119,7 +119,8 @@ fi case $1 in -n|-new) - ticket_id=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 10 | head -n 1) + # ticket_id=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 10 | head -n 1) + ticket_id=$(echo -n "$(date)" | md5sum | cut -c 9-20) ticket_file=$TICKETS/$ticket_id printf "id: %s\n" $ticket_id > $ticket_file printf "responsible: %s\n" `whoami`@`hostname` >> $ticket_file @@ -131,7 +132,7 @@ printf "Describe your problem here\n" >> $ticket_file $EDITOR $ticket_file ;; -o|-open) - printf "%-12s %-21s %s\n" "Ticket ID" "Created at" "Title" + printf "%-14s %-21s %s\n" "Ticket ID" "Created at" "Title" printf "%0.s-" {1..100} printf "\n" grep --color=never -l 'status: open' $TICKETS/* | while read file; do @@ -139,11 +140,11 @@ id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }') title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}') cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}') cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S") - printf "%-12s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" + printf "%-14s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" done ;; -c|-closed) - printf "%-12s %-21s %s\n" "Ticket ID" "Created at" "Title" + printf "%-14s %-21s %s\n" "Ticket ID" "Created at" "Title" printf "%0.s-" {1..100} printf "\n" grep --color=never -l 'status: closed' $TICKETS/* | while read file; do @@ -151,7 +152,7 @@ id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }') title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}') cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}') cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S") - printf "%-12s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" + printf "%-14s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" done ;; -h|-help)