FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
expresscpp/format_code.sh at master · expresscpp/expresscpp · GitHub
expresscpp
/
expresscpp
Public
Notifications
You must be signed in to change notification settings
Fork
15
Star
96
Code
Issues
5
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
expresscpp
/
format_code.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
87 lines (66 loc) · 2.13 KB
Breadcrumbs
expresscpp
/
format_code.sh
Copy path
File metadata and controls
executable file
·
87 lines (66 loc) · 2.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!
/bin/sh
#
This script searches all source code files and formats them according to the .clang-format style.
maj_min=5
maj_max=3
base=clang-format-9
format=
"
"
#
Redirect output to stderr.
exec
1>&2
#
check if clang-format is installed
type
"
$base
"
>
/dev/null
2>&1
&&
format=
"
$base
"
#
if not, check all possible versions
#
(i.e. clang-format-<$maj_min-$maj_max>-<0-9>)
if
[
-z
"
$format
"
]
then
for
j
in
`
seq
$maj_max
-1
$maj_min
`
do
for
i
in
`
seq 0 9
`
do
type
"
$base
-
$j
.
$i
"
>
/dev/null
2>&1
&&
format=
"
$base
-
$j
.
$i
"
&&
break
done
[
-z
"
$format
"
]
||
break
done
fi
asdf=
"
$(
which
$format
)
"
echo
"
$asdf
"
#
no versions of clang-format are installed
if
[
-z
"
$format
"
]
then
echo
"
$base
is not installed. Cannot format code...
"
exit
1
fi
echo
"
$format
was found, going to format your code...
"
>&2
find
$(
dirname
"
$0
"
)
/ \
-not
\(
-path
"
*/build/*
"
-prune
\)
\
-not
\(
-path
"
*/_build/*
"
-prune
\)
\
-not
\(
-path
"
*/cmake/*
"
-prune
\)
\
-not
\(
-path
"
*/config/*
"
-prune
\)
\
-not
\(
-path
"
*/scripts/*
"
-prune
\)
\
-not
\(
-path
"
*/.vscode/*
"
-prune
\)
\
-not
\(
-path
"
*/third_party/*
"
-prune
\)
\
-not
\(
-path
"
*/doc/*
"
-prune
\)
\
\(
-name
*
.h -o -name
*
.hpp -o -name
*
.c -o -name
*
.cc -o -name
*
.cpp -o -name
*
.proto
\)
\
|
xargs
$format
-i
echo
"
done formatting with clang
"
cmakeFormat=
"
cmake-format
"
asdf=
"
$(
which
$cmakeFormat
)
"
echo
"
$asdf
"
if
[
-z
"
$cmakeFormat
"
]
then
echo
"
$cmakeFormat
is not installed. Cannot format cmake files...
"
echo
"
run: sudo pip3 install cmake-format
"
exit
1
fi
echo
"
$cmakeFormat
was found, going to format your cmake scripts...
"
>&2
find
$(
dirname
"
$0
"
)
/ \
-not
\(
-path
"
*/build/*
"
-prune
\)
\
-not
\(
-path
"
*/_build/*
"
-prune
\)
\
-not
\(
-path
"
*/scripts/*
"
-prune
\)
\
-not
\(
-path
"
*/.vscode/*
"
-prune
\)
\
-not
\(
-path
"
*/third_party/*
"
-prune
\)
\
-not
\(
-path
"
*/cmake-build-debug/*
"
-prune
\)
\
-not
\(
-path
'
*/cmake/conan.cmake
'
-prune
\)
\
-not
\(
-path
'
*/cmake/debug.cmake
'
-prune
\)
\
\(
-name
*
.cmake -o -name CMakeLists.txt
!
-iname
"
*Find*
"
\)
\
|
xargs
$cmakeFormat
-c cmake-format.yaml -i
echo
"
done formatting with cmake-format
"
Back
|
FazBrowse Home
|
New Git URL