Skip to content

Instantly share code, notes, and snippets.

@Stewie410
Created September 15, 2025 11:52
Show Gist options
  • Select an option

  • Save Stewie410/212b0f294e1b7035a0447e813a4cdf48 to your computer and use it in GitHub Desktop.

Select an option

Save Stewie410/212b0f294e1b7035a0447e813a4cdf48 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
main() {
local -A count
local -a result
local i
while read -r i; do
case "${i:0:1}" in
A | C | D | I | M | R | X ) (( count["${i:0:1}"]++ ));;
"?" ) (( count["q"]++ ));;
"!" ) (( count["b"]++ ));;
"~" ) (( count["t"]++ ));;
esac
done < <(svn --non-interactive status --depth="immediates")
for i in "A" "C" "D" "I" "M" "R" "X" "q" "b" "t"; do
(( count["${i}"] > 0 )) || continue
case "${i}" in
q ) result+=( "?:${count["$i"]}" );;
b ) result+=( "!:${count["$i"]}" );;
t ) result+=( "~:${count["$i"]}" );;
* ) result+=( "${i}:${count["$i"]}" );;
esac
done
printf '%s' "${result[*]}"
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment