Skip to content

Commit

Permalink
feat: Backup bash parsing script for debugging purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
erikmd committed Jun 30, 2024
1 parent 782428b commit d8d44ca
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions debug_read.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Author: Erik Martin-Dorel, 2024, MIT license
# Script written for debugging purposes and just kept for the record.

message="chore(docker-keeper): nightly; propagate: ()
chore: Update images.yml; docker-keeper: rebuild-all; propagate: mathcomp: rebuild-all
chore: docker-keeper: rebuild-keyword: dev,8.20
Some more text!"

readarray -t lines < <(grep "\(^\|(\| \|;\)docker-keeper)\?:" <<< "$message")
declare -a DOCKER_KEEPER_CMDS

for line in "${lines[@]}"; do
cmd=$(sed -e 's/^.*docker-keeper)\?: *//g' <<< "$line")
readarray -t cmds < <(sed -e 's/; \?/\n/g' <<< "$cmd")
for cmd in "${cmds[@]}"; do
DOCKER_KEEPER_CMDS[${#DOCKER_KEEPER_CMDS[@]}]="$(sed -e 's/: \?/=/' <<< "$cmd")"
done
done

printf "'%s' " "${DOCKER_KEEPER_CMDS[@]/#/--}"

0 comments on commit d8d44ca

Please sign in to comment.