Unlucky Launcher v0.0.1-alpha
CI / fmt (rustfmt --check) (push) Canceled after 0s
CI / clippy (ubuntu-latest) (push) Canceled after 0s
CI / clippy (windows-latest) (push) Canceled after 0s
CI / test (ubuntu-latest) (push) Canceled after 0s
CI / test (windows-latest) (push) Canceled after 0s
CI / build release (ubuntu-latest) (push) Canceled after 0s
CI / build release (windows-latest) (push) Canceled after 0s
Guards / core 零 UI 守门 (push) Canceled after 0s
Guards / 文件行数 ≤400 守门 (push) Canceled after 0s
Guards / 依赖许可与来源(cargo-deny) (push) Canceled after 0s
CI / fmt (rustfmt --check) (push) Canceled after 0s
CI / clippy (ubuntu-latest) (push) Canceled after 0s
CI / clippy (windows-latest) (push) Canceled after 0s
CI / test (ubuntu-latest) (push) Canceled after 0s
CI / test (windows-latest) (push) Canceled after 0s
CI / build release (ubuntu-latest) (push) Canceled after 0s
CI / build release (windows-latest) (push) Canceled after 0s
Guards / core 零 UI 守门 (push) Canceled after 0s
Guards / 文件行数 ≤400 守门 (push) Canceled after 0s
Guards / 依赖许可与来源(cargo-deny) (push) Canceled after 0s
Rust 原生单文件 Minecraft 启动器:CLI 完整可用(install/launch/accounts/java/diagnose/agent), MCP server 接入外部 Agent 工具,GUI 开发中。
This commit is contained in:
commit
bc41dfcf7d
517 files changed
+92844
No files matched your search
@@ -0,0 +1,57 @@
|
||||
//! 元命令:`--version` / 无子命令 / `help`。
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use crate::cli::help;
|
||||
use crate::os;
|
||||
use crate::output::Report;
|
||||
|
||||
/// 启动器名(`${launcher_name}` 与 `--version` 输出共用)。
|
||||
pub const LAUNCHER_NAME: &str = "UnluckyLauncher";
|
||||
|
||||
/// 版本 + 系统摘要(`ull --version`,D19 §5-2 要求附带 os 摘要)。
|
||||
///
|
||||
/// 探测走 `core::platform::os_info::current()`(进程内缓存),未达基线时附带升级指引。
|
||||
#[must_use]
|
||||
pub fn version() -> Report {
|
||||
let info = os::detect();
|
||||
let data = json!({
|
||||
"name": "ull",
|
||||
"package": env!("CARGO_PKG_NAME"),
|
||||
"version": env!("CARGO_PKG_VERSION"),
|
||||
"os": os::to_json(&info),
|
||||
});
|
||||
let mut human = vec![
|
||||
format!(
|
||||
"ull {}({})",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
env!("CARGO_PKG_NAME")
|
||||
),
|
||||
format!("os: {}", os::summary_line(&info)),
|
||||
];
|
||||
human.extend(os::notes(&info));
|
||||
Report::new(data, human)
|
||||
}
|
||||
|
||||
/// 无子命令:版本摘要 + 帮助(用户原话「无子命令时 --version + --help」)。
|
||||
#[must_use]
|
||||
pub fn welcome() -> Report {
|
||||
let version_report = version();
|
||||
let mut human = version_report.human;
|
||||
human.push(String::new());
|
||||
human.extend(help::general().lines().map(str::to_string));
|
||||
let mut data = version_report.data;
|
||||
data["help"] = json!(help::general());
|
||||
Report::new(data, human)
|
||||
}
|
||||
|
||||
/// 帮助(`ull help <命令>` 给该命令,未知主题退回总帮助)。
|
||||
#[must_use]
|
||||
pub fn help(topic: Option<&str>) -> Report {
|
||||
let text = topic.and_then(help::topic).unwrap_or_else(help::general);
|
||||
let data = json!({
|
||||
"topic": topic,
|
||||
"text": text,
|
||||
});
|
||||
Report::new(data, text.lines().map(str::to_string).collect())
|
||||
}
|
||||
Reference in new issue
Block a user