-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfmt.sh
More file actions
executable file
·50 lines (41 loc) · 1.27 KB
/
Copy pathfmt.sh
File metadata and controls
executable file
·50 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
#################################################
#### Ensure we are in the right path. ###########
#################################################
if [[ 0 -eq $(echo $0 | grep -c '^/') ]]; then
# relative path
EXEC_PATH=$(dirname "`pwd`/$0")
else
# absolute path
EXEC_PATH=$(dirname "$0")
fi
EXEC_PATH=$(echo ${EXEC_PATH} | sed 's@/\./@/@g' | sed 's@/\.*$@@')
cd $EXEC_PATH || exit 1
#################################################
export LC_ALL=en_US.UTF-8 # perl
for file in $(find .. -type f \
-name "*.rs" \
-o -name "*.c" \
-o -name "*.h" \
-o -name "*.sh" \
-o -name "*.toml" \
-o -name "*.json" \
-o -name "*.md"\
-o -name "rc.local"\
| grep -v "$(basename $0)" \
| grep -v 'target/' \
| grep -v 'postgres'); do
perl -p -i -e 's/ / /g' $file
perl -p -i -e 's/!/!/g' $file
perl -p -i -e 's/(/(/g' $file
perl -p -i -e 's/)/)/g' $file
perl -p -i -e 's/:/: /g' $file
perl -p -i -e 's/, */, /g' $file
perl -p -i -e 's/。 */. /g' $file
perl -p -i -e 's/、 +/、/g' $file
perl -p -i -e 's/, +/, /g' $file
perl -p -i -e 's/\. +/. /g' $file
perl -p -i -e 's/\t/ /g' $file
perl -p -i -e 's/ +$//g' $file
done
~/.cargo/bin/cargo +nightly fmt --all