File tree 1 file changed +15
-14
lines changed
1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -4,26 +4,27 @@ echo ""
4
4
echo " Please make sure that you have already updated the src/xpanse-api/api.json."
5
5
echo " "
6
6
echo -n " Press any key to continue..."
7
- read answer
7
+ read -r answer
8
8
9
- # Get the directory of the currently running script
10
- SCRIPT_DIR =" $( cd " $( dirname " $0 " ) " && pwd ) "
9
+ SCRIPT_DIR= " $( cd " $( dirname " $0 " ) " &&
10
+ API_DIR =" ${SCRIPT_DIR} /../src/xpanse-api/ "
11
11
12
- # Get the root directory of xpanse-api
13
- API_DIR=${SCRIPT_DIR} /../src/xpanse-api/
14
-
15
- # Generate API files
16
12
npx @hey-api/openapi-ts
17
13
18
- $(
19
- cd ${API_DIR}
14
+ (
15
+ cd " ${API_DIR} " || exit 1
16
+
17
+ FILE_NEED_ADD_LICENSE=$( grep -L " SPDX-License-Identifier" ./ --exclude=' *.json' -R)
20
18
21
- FILE_NEED_ADD_LICENSE=$( grep -L " SPDX-License-Identifier" ./ --exclude * .json -R)
19
+ for FILE in $FILE_NEED_ADD_LICENSE ; do
20
+ echo " Updating license header in: $FILE "
22
21
23
- for FILE in $FILE_NEED_ADD_LICENSE
24
- do
25
- echo $FILE
26
- sed -i ' 1s#^#/*\n * SPDX-License-Identifier: Apache-2.0\n * SPDX-FileCopyrightText: Huawei Inc.\n */\n\n#' $FILE
22
+ if [[ " $OSTYPE " == " darwin" * ]]; then
23
+ sed -i ' ' ' 1s#^#/*\n * SPDX-License-Identifier: Apache-2.0\n * SPDX-FileCopyrightText: Huawei Inc.\n */\n\n#' " $FILE "
24
+ else
25
+ # Linux
26
+ sed -i ' 1s#^#/*\n * SPDX-License-Identifier: Apache-2.0\n * SPDX-FileCopyrightText: Huawei Inc.\n */\n\n#' " $FILE "
27
+ fi
27
28
done
28
29
)
29
30
You can’t perform that action at this time.
0 commit comments