Update make tools: add help , support windows#667
Conversation
| spx exportweb | ||
| cd ./project/.builds/web | ||
| rm -f game.zip | ||
| zip -r "$CURRENT_PATH/spx_web.zip" * |
There was a problem hiding this comment.
note: Use ./glob or -- glob so names with dashes won't become options. [SC2035]
Details
lint 解释
这个lint结果提示你使用 ./*glob* 或 -- *glob* 来匹配文件名,这样可以避免包含连字符的文件名被误认为是命令行选项。
错误用法
ls *.txt在这个例子中,如果当前目录下有一个名为 file-name.txt 的文件,使用 ls *.txt 会导致 file-name.txt 被误解为一个选项而不是文件名。
正确用法
ls ./*.txt或者
ls -- *.txt这两种方式都可以确保包含连字符的文件名被正确识别为文件名,而不是命令行选项。
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
| } | ||
|
|
||
| # Execute the exportpack commands | ||
| cd "$CURRENT_PATH/.tmp/web" |
There was a problem hiding this comment.
warning: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. [SC2164]
Details
lint 解释
这个lint结果表明在脚本中使用了cd ...命令,但没有处理可能的失败情况。如果cd命令执行失败,脚本将继续执行后续的代码,这可能会导致意外的行为。
错误用法
cd /path/to/directory
# 如果 cd 失败,脚本会继续执行
echo "Directory changed"正确用法
cd /path/to/directory || exit 1
# 或者
cd /path/to/directory || return 1
# 如果 cd 失败,脚本会退出或返回错误码
echo "Directory changed"💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
| # Define a function for the exportpack functionality | ||
| do_extra_webtemplate() { | ||
| do_prepare_export | ||
| dstdir="$GOPATH/bin/gdspxrt"$TEMP_VERSION"_web" |
There was a problem hiding this comment.
warning: The surrounding quotes actually unquote this. Remove or escape them. [SC2027]
Details
lint 解释
这个lint结果表明在脚本中使用了反引号(`)来执行命令,但周围的引号导致反引号内的内容被解释为普通字符串而不是命令。这通常是因为反引号和引号的嵌套使用不当。
错误用法
echo "The current date is `date`"在这个例子中,反引号内的date命令被错误地解释为普通字符串,而不是执行日期命令并输出结果。
正确用法
echo "The current date is $(date)"在这个例子中,使用了$(...)语法来正确地嵌套命令和引号。这样,date命令会被执行,并且其输出会被插入到字符串中。
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
| @@ -261,7 +261,35 @@ ensure_emsdk() { | |||
| if [[ "$(uname -o 2>/dev/null)" == "Msys" ]] || [[ "$(uname -o 2>/dev/null)" == "Cygwin" ]]; then | |||
| # Windows | |||
| source ./emsdk_env.sh | |||
There was a problem hiding this comment.
note: Not following: ./emsdk_env.sh was not specified as input (see shellcheck -x). [SC1091]
Details
lint 解释
这个lint结果表明在脚本中引用了./emsdk_env.sh文件,但该文件没有被指定为输入。ShellCheck工具(shellcheck)通过-x选项来检查脚本的执行情况,并且会提示未指定的输入文件。
错误用法
source ./emsdk_env.sh在这个示例中,./emsdk_env.sh被引用但没有被指定为输入。
正确用法
要解决这个问题,可以使用ShellCheck提供的-x选项来指定输入文件。例如:
shellcheck -x ./emsdk_env.sh这样,ShellCheck会检查./emsdk_env.sh文件的执行情况,并提供相应的lint结果。
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
| fi | ||
| else | ||
| # Linux and macOS | ||
| source ./emsdk_env.sh |
There was a problem hiding this comment.
note: Not following: ./emsdk_env.sh was not specified as input (see shellcheck -x). [SC1091]
Details
lint 解释
这个lint结果表明在脚本中引用了./emsdk_env.sh文件,但该文件没有被指定为输入。ShellCheck工具(shellcheck)通过-x选项来检查脚本的执行情况,并且会提示未指定的输入文件。
错误用法
source ./emsdk_env.sh在这个示例中,./emsdk_env.sh被引用但没有被指定为输入。
正确用法
要解决这个问题,可以使用ShellCheck提供的-x选项来指定输入文件。例如:
shellcheck -x ./emsdk_env.sh这样,ShellCheck会检查./emsdk_env.sh文件的执行情况,并提供相应的lint结果。
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
| spx exportweb | ||
| cd ./project/.builds/web | ||
| rm -f game.zip | ||
| zip -r "$PROJ_DIR/spx_web.zip" * |
There was a problem hiding this comment.
note: Use ./glob or -- glob so names with dashes won't become options. [SC2035]
Details
lint 解释
这个lint结果提示你使用 ./*glob* 或 -- *glob* 来匹配文件名,这样可以避免包含连字符的文件名被误认为是命令行选项。
错误用法
ls *.txt在这个例子中,如果当前目录下有一个名为 file-name.txt 的文件,使用 ls *.txt 会导致 file-name.txt 被误解为一个命令行选项,而不是一个文件名。
正确用法
ls ./*.txt或者
ls -- *.txt这两种方式都可以确保包含连字符的文件名被正确识别为文件名,而不是命令行选项。
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
| } | ||
|
|
||
| # Execute the exportpack commands | ||
| cd "$PROJ_DIR/.tmp/web" |
There was a problem hiding this comment.
warning: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. [SC2164]
Details
lint 解释
这个lint结果表明在脚本中使用了cd ...命令,但没有处理可能的失败情况。如果cd命令执行失败,脚本将继续执行后续的命令,这可能会导致意外的行为。
错误用法
cd /path/to/directory
# 如果 cd 失败,脚本会继续执行
echo "Directory changed"正确用法
cd /path/to/directory || exit 1
# 或者
cd /path/to/directory || return 1
# 如果 cd 失败,脚本会退出或返回错误码
echo "Directory changed"💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
|
|
||
| echo "exporting web runtime..." | ||
| spx exportwebruntime | ||
| dstdir="$GOPATH/bin/gdspxrt"$TEMP_VERSION"_web" |
There was a problem hiding this comment.
warning: The surrounding quotes actually unquote this. Remove or escape them. [SC2027]
Details
lint 解释
这个lint结果表明在脚本中使用了反引号(`)来执行命令,但反引号内部的字符串被错误地用双引号或单引号包围。这会导致反引号无法正确解析内部的变量或命令。
错误用法
result=`echo "Hello, $USER"`在这个例子中,$USER 被错误地用双引号包围,导致反引号无法正确解析 $USER 变量。
正确用法
result=$(echo "Hello, $USER")在这个例子中,使用了 $() 语法来执行命令,这样可以正确解析内部的变量。
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
3f424c2 to
8283ba2
Compare
8283ba2 to
f0bdf9f
Compare
make tools support windows platform