Skip to content

feat: 完善外部调用:命令行#1785

Open
NaraLan0502 wants to merge 1 commit intoScighost:mainfrom
NaraLan0502:main
Open

feat: 完善外部调用:命令行#1785
NaraLan0502 wants to merge 1 commit intoScighost:mainfrom
NaraLan0502:main

Conversation

@NaraLan0502
Copy link
Copy Markdown

@NaraLan0502 NaraLan0502 commented Apr 4, 2026

改动

  1. 完善命令行(CL)调用 GameCliRunner.cs ,支持回显UTF-8编码日志(回显日志的测试脚本:test_cmd_capture.py),CL调用细则见 ExternalInvocation.md
  2. 将位于UI层的更新/修复游戏的详细信息处理相关代码提取并暴露于 GameInstallProgressFormatter.cs
  3. UrlProtocol.md 更名为 ExternalInvocation.md ,补充相关文档

测试脚本

调用方式

python test_cmd_capture.py {command} --cwd {workfold}
Key Description
command 将要运行的命令,需用""包裹
workfold 工作文件夹

使用范例

运行

python test_cmd_capture.py "starward updategame --action check --biz hk4e_cn" --cwd "D:\Starward\app-0.16.4-pre.5"

回显

=== CMD TEST START ===
command   : starward updategame --action check --biz hk4e_cn
cwd       : D:\Starward\app-0.16.4-pre.5
[stdout] [18:37:29.032] 检查预下载/更新成功: biz=hk4e_cn, local=6.4.0, latest=6.4.0, predownload=<null>, need_update=False, need_predownload=False, predownload_finished=False
=== CMD TEST RESULT ===
time      : 2026-04-04T18:37:29
cwd       : D:\Starward\app-0.16.4-pre.5
command   : starward updategame --action check --biz hk4e_cn
returncode: 0
stdout_len: 157
stderr_len: 0

目前存在的问题

  1. 只支持startgameupdategame,不支持playtimerpc
  2. 为了回显以UTF-8编码的日志,只在 GameCliRunner.cs 里设置了编码方式,未全局设置
  3. 需要外部脚本才能回显日志(个人觉得这个不算是问题)
  4. 未适配i18n

todo

如果功能扩展得足够多且需要回显日志,可能会写个Starward.CLI,像现在这样有点麻烦说是

@NaraLan0502 NaraLan0502 changed the title 新增调用方式:命令行 feat: 新增调用方式:命令行 Apr 4, 2026
@NaraLan0502 NaraLan0502 changed the title feat: 新增调用方式:命令行 feat: 完善外部调用:命令行 Apr 8, 2026
@NaraLan0502 NaraLan0502 marked this pull request as ready for review April 8, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant