From 604a8e5e53cdc7391a502fcabf07e8f1cc2a778c Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 21 Jan 2026 10:05:19 +0800 Subject: Update. --- doc/docs/doc/README.md | 61 +++++++++++++++++++++++++++----------------- doc/docs/zh/doc/README.md | 65 ++++++++++++++++++++++++++++------------------- 2 files changed, 77 insertions(+), 49 deletions(-) (limited to 'doc') diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md index b5051d4..8569a10 100755 --- a/doc/docs/doc/README.md +++ b/doc/docs/doc/README.md @@ -196,29 +196,44 @@ f!  Use YueScript tool with: ``` > yue -h -Usage: yue [options|files|directories] ... - - -h Print this message - -e str Execute a file or raw codes - -m Generate minified codes - -r Rewrite output to match original line numbers - -t path Specify where to place compiled files - -o file Write output to file - -s Use spaces in generated codes instead of tabs - -p Write output to standard out - -b Dump compile time (doesn't write output) - -g Dump global variables used in NAME LINE COLUMN - -l Write line numbers from source codes - -j Disable implicit return at end of file - -c Reserve comments before statement from source codes - -w path Watch changes and compile every file under directory - -v Print version - -- Read from standard in, print to standard out - (Must be first and only argument) - - --target=version Specify the Lua version codes the compiler will generate - (version can only be 5.1, 5.2, 5.3 or 5.4) - --path=path_str Append an extra Lua search path string to package.path +Usage: yue + [options] [] ... + yue -e [args...] + yue -w [] [options] + yue - + +Notes: + - '-' / '--' must be the first and only argument. + - '-o/--output' can not be used with multiple input files. + - '-w/--watch' can not be used with file input (directory only). + - with '-e/--execute', remaining tokens are treated as script args. + +Options: + -h, --help Show this help message and exit. + -e , --execute Execute a file or raw codes + -m, --minify Generate minified codes + -r, --rewrite Rewrite output to match original line numbers + -t , --output-to + Specify where to place compiled files + -o , --output Write output to file + -p, --print Write output to standard out + -b, --benchmark Dump compile time (doesn't write output) + -g, --globals Dump global variables used in NAME LINE COLUMN + -s, --spaces Use spaces in generated codes instead of tabs + -l, --line-numbers Write line numbers from source codes + -j, --no-implicit-return Disable implicit return at end of file + -c, --reserve-comments Reserve comments before statement from source codes + -w [], --watch [] + Watch changes and compile every file under directory + -v, --version Print version + - Read from standard in, print to standard out + (Must be first and only argument) + -- Same as '-' (kept for backward compatibility) + + --target Specify the Lua version that codes will be generated to + (version can only be 5.1 to 5.5) + --path Append an extra Lua search path string to package.path + --= Pass compiler option in key=value form (existing behavior) Execute without options to enter REPL, type symbol '$' in a single line to start/stop multi-line mode diff --git a/doc/docs/zh/doc/README.md b/doc/docs/zh/doc/README.md index 43713fe..a3ff7cb 100755 --- a/doc/docs/zh/doc/README.md +++ b/doc/docs/zh/doc/README.md @@ -195,32 +195,45 @@ f! 使用月之脚本编译工具: ``` -使用命令: yue [选项|文件|目录] ... - - -h 打印此消息 - -e str 执行一个文件或一段原始代码 - -m 生成压缩后的代码 - -r 重写输出的Lua代码以匹配原始代码中的行号 - -t path 指定放置编译结果文件的位置 - -o file 将输出写到指定的文件中 - -s 在生成的代码中使用空格代替制表符 - -p 将输出写入标准输出 - -b 输出编译时间(不写输出) - -g 以“名称 行号 列号”的形式输出代码中使用的全局变量 - -l 在输出的每一行代码的末尾写上原代码的行号 - -j 禁用文件末尾的隐式返回 - -c 在输出的代码中保留语句前的注释 - -w path 监测目录下的文件更改并重新编译生成目录下的文件 - -v 打印版本号 - -- 从标准输入读取原始代码,打印到编译结果到标准输出 - (必须是第一个且是唯一的参数) - - --target=version 指定编译器将生成的Lua代码版本号 - (版本号只能是 5.1, 5.2, 5.3 或 5.4) - --path=path_str 将额外的Lua搜索路径字符串追加到package.path - - 不添加任何选项执行命令可以进入REPL模式, - 在单行输入符号 '$' 并换行后,可以开始或是停止多行输入模式 +命令行用法: yue + [选项] [<文件/目录>] ... + yue -e <代码或文件> [参数...] + yue -w [<目录>] [选项] + yue - + +说明: + - '-' 或 '--' 必须作为唯一且第一个参数,用于读取标准输入。 + - '-o/--output' 不能与多个输入文件一起使用。 + - '-w/--watch' 仅能用于目录,不能用于单个文件。 + - 使用 '-e/--execute' 时,后续的参数将作为脚本参数传递。 + +选项: + -h, --help 显示帮助信息并退出 + -e <字符串>, --execute <字符串> 执行文件或原始代码 + -m, --minify 生成压缩(最小化)代码 + -r, --rewrite 重写输出以匹配原始代码行号 + -t <目标路径>, --output-to <目标路径> + 指定编译后文件的输出路径 + -o <文件>, --output <文件> 将输出写入文件 + -p, --print 输出到标准输出 + -b, --benchmark 输出编译耗时(不写入文件) + -g, --globals 显示用到的全局变量及其所在的名称、行号、列号 + -s, --spaces 用空格代替制表符(tab)输出代码 + -l, --line-numbers 输出源代码的行号 + -j, --no-implicit-return 禁用文件末尾的隐式返回 + -c, --reserve-comments 保留源代码中的注释 + -w [<目录>], --watch [<目录>] + 监视目录变化并自动编译 + -v, --version 显示版本信息 + - 从标准输入读取,输出到标准输出(仅能作为唯一参数) + -- 等同于 '-',为兼容旧版本保留 + + --target <版本> 指定生成代码的 Lua 版本 (只能为 5.1 ~ 5.5) + --path <路径字符串> 附加一个 Lua 搜索路径到 package.path + --<键>=<值> 以 key=value 形式传递编译器选项(保持已有用法) + + 不带选项直接运行可进入交互模式(REPL),在交互模式里输入单独的符号 '$' + 可用于开始或结束多行模式。 ```   使用案例:   递归编译当前路径下扩展名为 **.yue** 的每个月之脚本文件: **yue .** -- cgit v1.2.3-55-g6feb