From 6add7b744c0d2f90b3a28ec3e561a4f2c91f6375 Mon Sep 17 00:00:00 2001 From: Da Shen Date: Sat, 21 Mar 2026 15:38:34 +0800 Subject: [PATCH] =?UTF-8?q?[200=5F41]=20=E6=9B=B4=E6=96=B0=20README.md?= =?UTF-8?q?=EF=BC=9A=E5=B0=86=20bin/goldfish=20=E6=94=B9=E4=B8=BA=20bin/gf?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=AD=90=E5=91=BD=E4=BB=A4=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 116 ++++++++++++++++++++++++------------------------ devel/200_41.md | 25 +++++++++++ 2 files changed, 83 insertions(+), 58 deletions(-) create mode 100644 devel/200_41.md diff --git a/README.md b/README.md index c27f4bc0..1e8bca9c 100644 --- a/README.md +++ b/README.md @@ -134,12 +134,12 @@ git clone https://gitee.com/LiiiLabs/goldfish.git # git clone https://github.com/LiiiLabs/goldfish.git cd goldfish xmake b goldfish -bin/goldfish --version +bin/gf --version ``` You can also install it to `/opt`: ``` sudo xmake i -o /opt/goldfish --root -/opt/goldfish/bin/goldfish +/opt/goldfish/bin/gf ``` For uninstallation, just: ``` @@ -147,80 +147,80 @@ sudo rm -rf /opt/goldfish ``` ## Commandlinefu -This section assumes you have executed `xmake b goldfish` sucessfully and `bin/goldfish` is available. +This section assumes you have executed `xmake b goldfish` sucessfully and `bin/gf` is available. -### Zero Option -Without any options, it will print the help message: +### Subcommands + +Goldfish Scheme uses subcommands for different operations: + +| Subcommand | Description | +|------------|-------------| +| `help` | Display help message | +| `version` | Display version information | +| `eval CODE` | Evaluate Scheme code | +| `load FILE` | Load Scheme file and enter REPL | +| `repl` | Enter interactive REPL mode | +| `run TARGET` | Run main function from target | +| `test` | Run tests | +| `fix PATH` | Format Scheme code | +| `FILE` | Load and evaluate Scheme file directly | + +### Display Help +Without any command, it will print the help message: ``` -> bin/goldfish -Goldfish Scheme 17.10.0 by LiiiLabs ---version display version --e -e '(+ 1 2)' --l FILE Load the scheme code on path -FILE Load the scheme code on path and print the evaluated result +> bin/gf +Goldfish Scheme 17.11.30 by LiiiLabs + +Commands: + help Display this help message + version Display version + eval CODE Evaluate Scheme code + load FILE Load Scheme code from FILE, then enter REPL + ... ``` -### Version Option -`--version` will print the Goldfish Scheme version and the underlying S7 Scheme version: +### Display Version +`version` subcommand will print the Goldfish Scheme version and the underlying S7 Scheme version: ``` -> bin/goldfish --version -Goldfish Scheme 17.10.0 by LiiiLabs -based on S7 Scheme 10.11 (2-July-2024) +> bin/gf version +Goldfish Scheme 17.11.30 by LiiiLabs +based on S7 Scheme 11.5 (22-Sep-2025) ``` -### Mode Option -`-m` helps you specify the standard libray mode. - -+ `default`: `-m default` is the equiv of `-m liii` -+ `liii`: Goldfish Scheme with `(liii oop)`, `(liii base)` and `(liii error)` -+ `scheme`: Goldfish Scheme with `(liii base)` and `(liii error)` -+ `sicp`: S7 Scheme with `(scheme base)` and `(srfi sicp)` -+ `r7rs`: S7 Scheme with `(scheme base)` -+ `s7`: S7 Scheme without any extra library - -### Other Options -`-e` helps you evaluate the scheme code on the fly: +### Evaluate Code +`eval` subcommand helps you evaluate Scheme code on the fly: ``` -> bin/goldfish -e "(+ 1 2)" +> bin/gf eval "(+ 1 2)" 3 -> bin/goldfish -e "(begin (import (srfi srfi-1)) (first (list 1 2 3)))" +> bin/gf eval "(begin (import (srfi srfi-1)) (first (list 1 2 3)))" 1 -> bin/goldfish -e "(begin (import (liii sys)) (display (argv)) (newline))" 1 2 3 -("bin/goldfish" "-e" "(begin (import (liii sys)) (display (argv)) (newline))" "1" "2" 3) -#\newline +> bin/gf eval "(begin (import (liii sys)) (display (argv)) (newline))" 1 2 3 +("bin/gf" "eval" "(begin (import (liii sys)) (display (argv)) (newline))" "1" "2" "3") ``` -`-l` helps you load the FILE: +### Load File +`load` subcommand helps you load a Scheme file and enter REPL: ``` -> bin/goldfish -l tests/demo_error.scm - -;car argument, (), is nil but should be a pair -; (list) -; tests/demo_error.scm, line 1, position: 10 -; (list) - -> bin/goldfish -l tests/demo_no_error.scm -> bin/goldfish -l tests/demo_argv.scm 1 2 3 -("bin/goldfish" "tests/demo_argv.scm" "1" "2" "3") +> bin/gf load tests/goldfish/liii/base-test.scm +; load the file and enter REPL ``` -If no options provided, it will load the FILE and print the eval result: +### Run File Directly +You can also load and evaluate a Scheme file directly: +``` +> bin/gf tests/goldfish/liii/base-test.scm +; *** checks *** : 1973 correct, 0 failed. ``` -> bin/goldfish tests/demo_no_error.scm -tests/demo_no_error.scm => 3 -> bin/goldfish tests/demo_error.scm -;car argument, (), is nil but should be a pair -; (list) -; tests/demo_error.scm, line 1, position: 10 -; (list) +### Mode Option +`-m` or `--mode` helps you specify the standard library mode: -tests/demo_error.scm => wrong-type-arg -> bin/goldfish tests/demo_argv.scm 1 2 3 -("bin/goldfish" "tests/demo_argv.scm" "1" "2" "3") -tests/demo_argv.scm => #\newline -``` -Notice, the FILE and the eval result are separated by ` => `. ++ `default`: `-m default` is the equiv of `-m liii` ++ `liii`: Goldfish Scheme with `(liii oop)`, `(liii base)` and `(liii error)` ++ `scheme`: Goldfish Scheme with `(liii base)` and `(liii error)` ++ `sicp`: S7 Scheme with `(scheme base)` and `(srfi sicp)` ++ `r7rs`: S7 Scheme with `(scheme base)` ++ `s7`: S7 Scheme without any extra library ## Versioning diff --git a/devel/200_41.md b/devel/200_41.md new file mode 100644 index 00000000..510709af --- /dev/null +++ b/devel/200_41.md @@ -0,0 +1,25 @@ +# [200_41] 更新 README.md 中的命令引用 + +## 任务相关的代码文件 +- README.md + +## 如何测试 +验证命令示例正确性: +```bash +bin/gf version +bin/gf eval "(+ 1 2)" +bin/gf load tests/goldfish/liii/base-test.scm +bin/gf tests/goldfish/liii/base-test.scm +``` + +## 2026-03-21 更新命令引用从 bin/goldfish 到 bin/gf + +### What +1. 将所有 `bin/goldfish` 引用更新为 `bin/gf` +2. 将版本号更新为 `17.11.30` +3. 将 S7 Scheme 版本更新为 `11.5 (22-Sep-2025)` +4. 重写 Commandlinefu 章节,将旧选项风格 (`-e`, `-l`, `--version`) 更新为子命令风格 (`eval`, `load`, `version`) +5. 更新文件示例路径(移除不存在的 demo_*.scm) + +### Why +之前 CLI 重构已经将 `goldfish` 重命名为 `gf`,并将选项风格改为子命令风格,但 README.md 中的文档示例仍然使用旧的命令名和选项风格,需要保持文档与实际命令一致。