-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformat.sh
22 lines (21 loc) · 820 Bytes
/
format.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
filemask="$1"
additional_options="$2"
settings_file="$3"
tempfile=$(mktemp)
/opt/idea/bin/format.sh -m "$filemask" $additional_options -r -s /github/workspace/"$settings_file" /github/workspace/ | tee -a $tempfile
newly_formatted=$(cat $tempfile | grep "OK$" | wc -l)
formatted_well=$(cat $tempfile | grep "Formatted well$" | wc -l)
needs_reformatting=$(cat $tempfile | grep "Needs reformatting$" | wc -l)
echo "Formatted ($newly_formatted)":
cat $tempfile | grep -o -P '(?<=Formatting ).*(?=...OK)'
echo
echo "==================="
echo
echo "Formatted well ($formatted_well)":
cat $tempfile | grep -o -P '(?<=Checking ).*(?=...Formatted well)'
echo
echo "==================="
echo
echo "Needs reformatting ($needs_reformatting)":
! cat $tempfile | grep -o -P '(?<=Checking ).*(?=...Needs reformatting)'