mihomo-cli 26.10.95 → 26.10.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1213
- package/README.md +8 -1
- package/dist/index.js +142 -94
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,7 +127,7 @@ mihomo ui yacd # YACD
|
|
|
127
127
|
| ----------------------------- | -------------------------------------- |
|
|
128
128
|
| `mihomo sub` | 列出所有订阅(含流量、到期时间) |
|
|
129
129
|
| `mihomo sub use <name>` | 切换当前订阅(支持模糊匹配,自动重启;重启透传 `-s`/`-u` 等启动选项) |
|
|
130
|
-
| `mihomo sub add [url] [name]` |
|
|
130
|
+
| `mihomo sub add [url] [name]` | 添加订阅并自动切换(名称不可重复、不能以 `-` 开头;交互下不带 URL 时自动读剪贴板并确认) |
|
|
131
131
|
| `mihomo sub update` | 更新所有订阅 |
|
|
132
132
|
| `mihomo sub update <name>` | 更新指定订阅(支持模糊匹配) |
|
|
133
133
|
| `mihomo sub remove <name>` | 删除订阅(别名 `rm`/`delete`;精确名直接删,模糊匹配需确认,`-y` 跳过) |
|
|
@@ -398,6 +398,13 @@ mihomo start --update-timeout=30000 # 长选项 + 等号
|
|
|
398
398
|
|
|
399
399
|
可通过环境变量 `MIHOMO_CLI_DIR` 自定义数据目录位置。
|
|
400
400
|
|
|
401
|
+
其他环境变量:
|
|
402
|
+
|
|
403
|
+
| 变量 | 用途 |
|
|
404
|
+
| --- | --- |
|
|
405
|
+
| `MIHOMO_CLI_ALLOW_ANY_PLATFORM=1` | 非 macOS 上绕过平台守卫,仅供开发调试(功能不保证可用) |
|
|
406
|
+
| `MIHOMO_CLI_DAEMON_LABEL` | 覆盖服务 label,仅供隔离测试使用(随意改名会遗留无法管理的自启进程,日常勿设) |
|
|
407
|
+
|
|
401
408
|
## 覆写配置
|
|
402
409
|
|
|
403
410
|
覆写配置允许你在订阅配置基础上进行自定义修改,原始订阅文件保持独立
|
package/dist/index.js
CHANGED
|
@@ -271,7 +271,7 @@ function assertKnownFlags(args, known, command) {
|
|
|
271
271
|
if (!args) return;
|
|
272
272
|
const knownSet = new Set(known);
|
|
273
273
|
for (const a of args) {
|
|
274
|
-
if (!a.startsWith("-")
|
|
274
|
+
if (!a.startsWith("-")) continue;
|
|
275
275
|
if (knownSet.has(a)) continue;
|
|
276
276
|
const match = matchValueFlagToken(a);
|
|
277
277
|
if (match && match.form !== "exact" && knownSet.has(match.baseForm)) continue;
|
|
@@ -3935,7 +3935,7 @@ function parseOverrideKey(key) {
|
|
|
3935
3935
|
return { key: actualKey, forceOverwrite, arrayPrepend, arrayAppend };
|
|
3936
3936
|
}
|
|
3937
3937
|
function assertValidParsedKey(rawKey, parsed) {
|
|
3938
|
-
if (rawKey.startsWith("~")) {
|
|
3938
|
+
if (rawKey.startsWith("~") || parsed.key.includes("~")) {
|
|
3939
3939
|
throw new CliError(`\u8986\u5199\u952E "${rawKey}" \u7528\u4E86\u5DF2\u79FB\u9664\u7684 ~ \u64CD\u4F5C\u7B26`, {
|
|
3940
3940
|
label: "\u8986\u5199\u914D\u7F6E\u9519\u8BEF",
|
|
3941
3941
|
hint: ["\u6309 name \u5408\u5E76/\u8FFD\u52A0\u6570\u7EC4\u5143\u7D20\u7684 ~ \u4E0E ~? \u5DF2\u79FB\u9664\uFF0C\u6539\u7528 JS \u8986\u5199\u811A\u672C\uFF08README\u300C\u8986\u5199\u914D\u7F6E\u300D\u7AE0\u8282\u7684\u811A\u672C\u4E00\u8282\uFF09\u3002"]
|
|
@@ -3953,6 +3953,12 @@ function assertValidParsedKey(rawKey, parsed) {
|
|
|
3953
3953
|
hint: ["\u64CD\u4F5C\u7B26\uFF08!\u3001+\uFF09\u5FC5\u987B\u4FEE\u9970\u4E00\u4E2A\u771F\u5B9E\u7684\u952E\u540D\uFF0C\u5982 rules+\u3001dns!\u3002"]
|
|
3954
3954
|
});
|
|
3955
3955
|
}
|
|
3956
|
+
if (parsed.key.includes("!")) {
|
|
3957
|
+
throw new CliError(`\u8986\u5199\u952E "${rawKey}" \u7684\u64CD\u4F5C\u7B26\u4F4D\u7F6E\u77DB\u76FE`, {
|
|
3958
|
+
label: "\u8986\u5199\u914D\u7F6E\u9519\u8BEF",
|
|
3959
|
+
hint: ["\u6574\u4F53\u8986\u76D6\u7684 ! \u53EA\u80FD\u5199\u5728\u952E\u540D\u672B\u5C3E\u3001\u4E14\u4E0D\u80FD\u4E0E\u5176\u4ED6\u64CD\u4F5C\u7B26\u540C\u7528\uFF08key!\uFF09\u3002", "\u60F3\u5411\u6570\u7EC4\u8FFD\u52A0\u8BF7\u53EA\u7528 key+\u3002"]
|
|
3960
|
+
});
|
|
3961
|
+
}
|
|
3956
3962
|
const ops = [];
|
|
3957
3963
|
if (parsed.forceOverwrite) ops.push("!\uFF08\u6574\u4F53\u8986\u76D6\uFF09");
|
|
3958
3964
|
if (parsed.arrayPrepend) ops.push("+\u524D\u7F00\uFF08\u6570\u7EC4\u524D\u63D2\uFF09");
|
|
@@ -3964,6 +3970,17 @@ function assertValidParsedKey(rawKey, parsed) {
|
|
|
3964
3970
|
});
|
|
3965
3971
|
}
|
|
3966
3972
|
}
|
|
3973
|
+
function describeValueKind(value) {
|
|
3974
|
+
if (value === null) return "null";
|
|
3975
|
+
if (typeof value === "object") return "\u6620\u5C04";
|
|
3976
|
+
return `\u6807\u91CF\uFF08${typeof value}\uFF09`;
|
|
3977
|
+
}
|
|
3978
|
+
function protoKeyInOverwriteError() {
|
|
3979
|
+
return new CliError('\u8986\u5199\u91CC\u51FA\u73B0\u4E86 "__proto__" \u952E', {
|
|
3980
|
+
label: "\u8986\u5199\u914D\u7F6E\u9519\u8BEF",
|
|
3981
|
+
hint: ["\u6B63\u5E38 mihomo \u914D\u7F6E\u6CA1\u6709\u8FD9\u4E2A\u952E\uFF0C\u8BF7\u68C0\u67E5\u8986\u5199\u6587\u4EF6\u7684\u5185\u5BB9\u4E0E\u6765\u6E90\u3002"]
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3967
3984
|
function mergeConfigLevel(target, override, parseOperators) {
|
|
3968
3985
|
let t = target;
|
|
3969
3986
|
if (t === null || t === void 0) {
|
|
@@ -3989,21 +4006,15 @@ function mergeConfigLevel(target, override, parseOperators) {
|
|
|
3989
4006
|
assertValidParsedKey(rawKey, { key, forceOverwrite, arrayPrepend, arrayAppend });
|
|
3990
4007
|
}
|
|
3991
4008
|
if (key === "__proto__") {
|
|
3992
|
-
throw
|
|
3993
|
-
label: "\u8986\u5199\u914D\u7F6E\u9519\u8BEF",
|
|
3994
|
-
hint: ["\u6B63\u5E38 mihomo \u914D\u7F6E\u6CA1\u6709\u8FD9\u4E2A\u952E\uFF0C\u8BF7\u68C0\u67E5\u8986\u5199\u6587\u4EF6\u7684\u5185\u5BB9\u4E0E\u6765\u6E90\u3002"]
|
|
3995
|
-
});
|
|
4009
|
+
throw protoKeyInOverwriteError();
|
|
3996
4010
|
}
|
|
3997
4011
|
const existingValue = result[key];
|
|
3998
4012
|
if (arrayPrepend || arrayAppend) {
|
|
3999
4013
|
if (existingValue !== void 0 && !Array.isArray(existingValue)) {
|
|
4000
|
-
throw new CliError(
|
|
4001
|
-
|
|
4002
|
-
{
|
|
4003
|
-
|
|
4004
|
-
hint: [`+${key} / ${key}+ \u7528\u4E8E\u5411\u6570\u7EC4\u524D\u7F6E/\u8FFD\u52A0\u5143\u7D20\uFF08\u5982 rules+\uFF09\u3002`, `\u82E5\u8981\u66FF\u6362\u975E\u6570\u7EC4\u7684 ${key}\uFF0C\u8BF7\u76F4\u63A5\u5199 ${key}: <\u503C>\u3002`]
|
|
4005
|
-
}
|
|
4006
|
-
);
|
|
4014
|
+
throw new CliError(`\u8986\u5199\u952E "${rawKey}" \u7684\u6570\u7EC4\u62FC\u63A5\u8BED\u4E49\u53EA\u9002\u7528\u4E8E\u6570\u7EC4\uFF0C\u4F46 "${key}" \u5F53\u524D\u662F ${describeValueKind(existingValue)}`, {
|
|
4015
|
+
label: "\u8986\u5199\u914D\u7F6E\u9519\u8BEF",
|
|
4016
|
+
hint: [`+${key} / ${key}+ \u7528\u4E8E\u5411\u6570\u7EC4\u524D\u7F6E/\u8FFD\u52A0\u5143\u7D20\uFF08\u5982 rules+\uFF09\u3002`, `\u82E5\u8981\u66FF\u6362\u975E\u6570\u7EC4\u7684 ${key}\uFF0C\u8BF7\u76F4\u63A5\u5199 ${key}: <\u503C>\u3002`]
|
|
4017
|
+
});
|
|
4007
4018
|
}
|
|
4008
4019
|
const existingArr = Array.isArray(existingValue) ? existingValue : [];
|
|
4009
4020
|
const overrideArr = Array.isArray(value) ? value : [value];
|
|
@@ -4084,22 +4095,22 @@ function normalizeMatch(raw, fileName) {
|
|
|
4084
4095
|
problems.push(`\u672A\u77E5\u952E "${key}"`);
|
|
4085
4096
|
continue;
|
|
4086
4097
|
}
|
|
4087
|
-
const arr = (Array.isArray(value) ? value : [value]).filter((v) => typeof v === "string" && v.length > 0);
|
|
4098
|
+
const arr = (Array.isArray(value) ? value : [value]).map((v) => typeof v === "string" ? v.trim() : v).filter((v) => typeof v === "string" && v.length > 0);
|
|
4088
4099
|
if (arr.length === 0) {
|
|
4089
4100
|
problems.push(`\u952E "${key}" \u7684\u503C\u4E3A\u7A7A\u6216\u65E0\u6709\u6548\u5B57\u7B26\u4E32`);
|
|
4090
4101
|
continue;
|
|
4091
4102
|
}
|
|
4092
4103
|
if (key === "url-domain") {
|
|
4093
|
-
const
|
|
4094
|
-
if (
|
|
4095
|
-
problems.push(
|
|
4104
|
+
const badEntry = arr.map((v) => [v, urlDomainValueProblem(v)]).find(([, p]) => p !== void 0);
|
|
4105
|
+
if (badEntry) {
|
|
4106
|
+
problems.push(badEntry[1]);
|
|
4096
4107
|
continue;
|
|
4097
4108
|
}
|
|
4098
4109
|
}
|
|
4099
4110
|
if (key === "name") {
|
|
4100
|
-
const
|
|
4101
|
-
if (
|
|
4102
|
-
throw new CliError(`\u8986\u5199\u6587\u4EF6 "${fileName}" \u7684 name \u901A\u914D\u5199\u6CD5\u4E0D\u652F\u6301: "${
|
|
4111
|
+
const badWildcard = arr.find((v) => !isValidNamePattern(v));
|
|
4112
|
+
if (badWildcard !== void 0) {
|
|
4113
|
+
throw new CliError(`\u8986\u5199\u6587\u4EF6 "${fileName}" \u7684 name \u901A\u914D\u5199\u6CD5\u4E0D\u652F\u6301: "${badWildcard}"`, {
|
|
4103
4114
|
label: "\u8986\u5199\u914D\u7F6E\u9519\u8BEF",
|
|
4104
4115
|
hint: [
|
|
4105
4116
|
"\u8BA2\u9605\u540D\u5339\u914D\u53EA\u652F\u6301\u4E24\u79CD\u901A\u914D\uFF1A\u5C3E\u90E8 *\uFF08\u524D\u7F00\uFF0Cedu* \u547D\u4E2D edu1\u3001\u4E0D\u547D\u4E2D xedu1\uFF09\u4E0E\u5934\u90E8 *\uFF08\u540E\u7F00\uFF0C*edu\uFF09\u3002",
|
|
@@ -4107,6 +4118,16 @@ function normalizeMatch(raw, fileName) {
|
|
|
4107
4118
|
]
|
|
4108
4119
|
});
|
|
4109
4120
|
}
|
|
4121
|
+
const impossible = arr.find((v) => !v.includes("*") && !SAFE_NAME_RE.test(v));
|
|
4122
|
+
if (impossible !== void 0) {
|
|
4123
|
+
throw new CliError(`\u8986\u5199\u6587\u4EF6 "${fileName}" \u7684 name \u503C\u4E0D\u53EF\u80FD\u5339\u914D\u4EFB\u4F55\u8BA2\u9605: "${impossible}"`, {
|
|
4124
|
+
label: "\u8986\u5199\u914D\u7F6E\u9519\u8BEF",
|
|
4125
|
+
hint: [
|
|
4126
|
+
"\u8BA2\u9605\u540D\u53EA\u80FD\u542B\u5B57\u6BCD\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u3001\u8FDE\u5B57\u7B26\u4E0E\u4E2D\u6587\uFF081-64 \u5B57\u7B26\uFF09\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u8BEF\u5E26\u4E86 /\u3001~\u3001\u7A7A\u683C\u3001\u70B9\u53F7\u7B49\u5B57\u7B26\u3002",
|
|
4127
|
+
"\u66F4\u590D\u6742\u7684\u5339\u914D\u5199 JS \u8986\u5199\u811A\u672C\uFF08README\u300C\u8986\u5199\u914D\u7F6E\u300D\u7AE0\u8282\uFF09\u3002"
|
|
4128
|
+
]
|
|
4129
|
+
});
|
|
4130
|
+
}
|
|
4110
4131
|
}
|
|
4111
4132
|
result[key] = arr;
|
|
4112
4133
|
}
|
|
@@ -4135,6 +4156,18 @@ function isValidNamePattern(value) {
|
|
|
4135
4156
|
if (value.indexOf("*", star + 1) !== -1) return false;
|
|
4136
4157
|
return star === 0 || star === value.length - 1;
|
|
4137
4158
|
}
|
|
4159
|
+
function urlDomainValueProblem(value) {
|
|
4160
|
+
if (value.includes("*") || value.includes("?")) {
|
|
4161
|
+
return `url-domain \u4E0D\u652F\u6301\u901A\u914D\u7B26\uFF08\u5F53\u524D\u503C "${value}"\uFF09\uFF0C\u53EA\u505A\u5B57\u9762\u540E\u7F00\u6BD4\u5BF9`;
|
|
4162
|
+
}
|
|
4163
|
+
if (/[:/]/.test(value)) {
|
|
4164
|
+
return `url-domain \u53EA\u8981\u88F8\u57DF\u540D\uFF08\u5F53\u524D\u503C "${value}"\uFF09\uFF1A\u4E0D\u8981\u5E26\u534F\u8BAE\u3001\u8DEF\u5F84\u6216\u7AEF\u53E3\uFF0C\u8BF7\u53BB\u6389 https://\u3001\u5C3E\u659C\u6760\u4E0E\u7AEF\u53E3`;
|
|
4165
|
+
}
|
|
4166
|
+
if (/\s/.test(value)) {
|
|
4167
|
+
return `url-domain \u53EA\u8981\u88F8\u57DF\u540D\uFF08\u5F53\u524D\u503C "${value}"\uFF09\uFF1A\u503C\u4E2D\u4E0D\u80FD\u542B\u7A7A\u683C`;
|
|
4168
|
+
}
|
|
4169
|
+
return void 0;
|
|
4170
|
+
}
|
|
4138
4171
|
function summarizeMatch(match) {
|
|
4139
4172
|
if (!match) return void 0;
|
|
4140
4173
|
const parts = [];
|
|
@@ -4212,11 +4245,11 @@ function assertFileLevelOperatorRules(config, fileName) {
|
|
|
4212
4245
|
for (const rawKey of Object.keys(config)) {
|
|
4213
4246
|
const parsed = parseOverrideKey(rawKey);
|
|
4214
4247
|
assertValidParsedKey(rawKey, parsed);
|
|
4248
|
+
if (parsed.key === "__proto__") throw protoKeyInOverwriteError();
|
|
4215
4249
|
if (!parsed.arrayPrepend && !parsed.arrayAppend) continue;
|
|
4216
4250
|
const base = BASE_CONFIG[parsed.key];
|
|
4217
4251
|
if (base === void 0 || Array.isArray(base)) continue;
|
|
4218
|
-
|
|
4219
|
-
throw new CliError(`\u8986\u5199\u6587\u4EF6 "${fileName}" \u7684\u952E "${rawKey}" \u7528\u4E86\u6570\u7EC4\u62FC\u63A5\uFF0C\u4F46\u7CFB\u7EDF\u914D\u7F6E "${parsed.key}" \u7684\u9ED8\u8BA4\u503C\u662F${kind}\u3001\u4E0D\u662F\u6570\u7EC4`, {
|
|
4252
|
+
throw new CliError(`\u8986\u5199\u6587\u4EF6 "${fileName}" \u7684\u952E "${rawKey}" \u7528\u4E86\u6570\u7EC4\u62FC\u63A5\uFF0C\u4F46\u7CFB\u7EDF\u914D\u7F6E "${parsed.key}" \u7684\u9ED8\u8BA4\u503C\u662F ${describeValueKind(base)}\u3001\u4E0D\u662F\u6570\u7EC4`, {
|
|
4220
4253
|
label: "\u8986\u5199\u914D\u7F6E\u9519\u8BEF",
|
|
4221
4254
|
hint: [
|
|
4222
4255
|
`+${parsed.key} / ${parsed.key}+ \u7528\u4E8E\u5411\u6570\u7EC4\u524D\u7F6E/\u8FFD\u52A0\u5143\u7D20\uFF08\u5982 rules+\uFF09\uFF1B\u7CFB\u7EDF\u9ED8\u8BA4\u7684 ${parsed.key} \u4E0D\u662F\u6570\u7EC4\uFF0C\u62FC\u63A5\u53EA\u4F1A\u4EA7\u51FA\u5185\u6838\u65E0\u6CD5\u89E3\u6790\u7684\u914D\u7F6E\u3002`,
|
|
@@ -4728,8 +4761,12 @@ function formatTraffic(upload, download, total) {
|
|
|
4728
4761
|
function formatTimestamp(ts) {
|
|
4729
4762
|
if (ts === void 0 || ts === null) return "\u672A\u77E5";
|
|
4730
4763
|
if (ts === 0) return "\u6C38\u4E45";
|
|
4764
|
+
const num = Number(ts);
|
|
4765
|
+
if (!Number.isFinite(num) || num < 0) return "\u672A\u77E5";
|
|
4731
4766
|
try {
|
|
4732
|
-
|
|
4767
|
+
const date = new Date(num * 1e3);
|
|
4768
|
+
if (Number.isNaN(date.getTime())) return "\u672A\u77E5";
|
|
4769
|
+
return date.toLocaleString("zh-CN");
|
|
4733
4770
|
} catch {
|
|
4734
4771
|
return "\u672A\u77E5";
|
|
4735
4772
|
}
|
|
@@ -5001,14 +5038,9 @@ function isPidFileOwnedByRoot() {
|
|
|
5001
5038
|
}
|
|
5002
5039
|
function checkStaleState() {
|
|
5003
5040
|
const allPids = getMihomoPids();
|
|
5004
|
-
const hasRootProcess = allPids.some((p) => isProcessRoot(p));
|
|
5005
|
-
const hasRootPidFile = isPidFileOwnedByRoot();
|
|
5006
5041
|
return {
|
|
5007
|
-
needsCleanup: allPids.length > 0 ||
|
|
5008
|
-
allPids
|
|
5009
|
-
hasRootProcess,
|
|
5010
|
-
hasRootPidFile,
|
|
5011
|
-
needsSudo: hasRootProcess || hasRootPidFile
|
|
5042
|
+
needsCleanup: allPids.length > 0 || isPidFileOwnedByRoot(),
|
|
5043
|
+
allPids
|
|
5012
5044
|
};
|
|
5013
5045
|
}
|
|
5014
5046
|
function getProcessInfo(pid) {
|
|
@@ -5048,12 +5080,18 @@ var SudoAuthError = class extends Error {
|
|
|
5048
5080
|
this.name = "SudoAuthError";
|
|
5049
5081
|
}
|
|
5050
5082
|
};
|
|
5083
|
+
function describeSudoFailure(e) {
|
|
5084
|
+
return e instanceof SudoAuthError ? "sudo \u5DF2\u53D6\u6D88\u6216\u5BC6\u7801\u9519\u8BEF" : e.message;
|
|
5085
|
+
}
|
|
5051
5086
|
function sudoExitToError(action, status, codeMessages) {
|
|
5052
5087
|
if (status === 1) return new SudoAuthError();
|
|
5053
5088
|
if (status == null) return new Error(`${action}\u88AB\u4E2D\u65AD\uFF08sudo \u8FDB\u7A0B\u88AB\u4FE1\u53F7\u7EC8\u6B62\uFF09`);
|
|
5054
5089
|
const custom = codeMessages?.[status];
|
|
5055
5090
|
return new Error(custom ?? `${action}\u5931\u8D25\uFF08\u9000\u51FA\u7801 ${status}\uFF09`);
|
|
5056
5091
|
}
|
|
5092
|
+
function sudoTimeoutError(action) {
|
|
5093
|
+
return new Error(`${action}\u8D85\u65F6\uFF08${SUDO_TIMEOUT_MS / 1e3}s \u672A\u5B8C\u6210\uFF09\uFF1A\u5BC6\u7801\u8F93\u5165\u6216\u811A\u672C\u6267\u884C\u8D85\u8FC7\u65F6\u9650\uFF0C\u64CD\u4F5C\u53EF\u80FD\u53EA\u5B8C\u6210\u4E86\u4E00\u90E8\u5206\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u8BD5`);
|
|
5094
|
+
}
|
|
5057
5095
|
function runSudoScript(scriptBody, opts) {
|
|
5058
5096
|
if (!process.stdin.isTTY) {
|
|
5059
5097
|
throw new Error("\u5F53\u524D\u73AF\u5883\u65E0\u6CD5\u8F93\u5165\u7BA1\u7406\u5458\u5BC6\u7801\uFF08\u9700\u8981\u5728\u4EA4\u4E92\u5F0F\u7EC8\u7AEF\u8FD0\u884C sudo\uFF09");
|
|
@@ -5064,7 +5102,10 @@ function runSudoScript(scriptBody, opts) {
|
|
|
5064
5102
|
fs7.chmodSync(scriptPath, 448);
|
|
5065
5103
|
try {
|
|
5066
5104
|
const result = spawnSync3("sudo", [scriptPath], { stdio: "inherit", timeout: SUDO_TIMEOUT_MS });
|
|
5067
|
-
if (result.error)
|
|
5105
|
+
if (result.error) {
|
|
5106
|
+
if (result.error.code === "ETIMEDOUT") throw sudoTimeoutError(opts.action);
|
|
5107
|
+
throw result.error;
|
|
5108
|
+
}
|
|
5068
5109
|
if (result.status !== 0) throw sudoExitToError(opts.action, result.status, opts.codeMessages);
|
|
5069
5110
|
} finally {
|
|
5070
5111
|
try {
|
|
@@ -5089,33 +5130,32 @@ function clearRuntime() {
|
|
|
5089
5130
|
}
|
|
5090
5131
|
ensureDirs();
|
|
5091
5132
|
}
|
|
5092
|
-
function
|
|
5093
|
-
|
|
5094
|
-
const cancelled = outcome === "cancelled" || outcome instanceof SudoAuthError;
|
|
5095
|
-
const reason = cancelled ? "sudo \u53D6\u6D88\u6216\u5BC6\u7801\u9519\u8BEF" : "sudo \u6267\u884C\u5931\u8D25";
|
|
5096
|
-
console.warn(colors.yellow(`\u8B66\u544A: root \u5C5E\u4E3B\u7684 pid \u6587\u4EF6\u672A\u80FD\u6E05\u7406\uFF08${reason}\uFF09\uFF0C\u4E0B\u6B21 stop \u4F1A\u518D\u6B21\u5C1D\u8BD5`));
|
|
5133
|
+
function describePidCleanupFailure(err) {
|
|
5134
|
+
return `pid \u6587\u4EF6\u672A\u80FD\u6E05\u7406\uFF08${err.message}\uFF09`;
|
|
5097
5135
|
}
|
|
5098
|
-
function
|
|
5099
|
-
if (
|
|
5100
|
-
|
|
5101
|
-
return null;
|
|
5136
|
+
function warnPidCleanupFailed(err) {
|
|
5137
|
+
if (!err) return;
|
|
5138
|
+
console.warn(colors.yellow(`\u8B66\u544A: ${describePidCleanupFailure(err)}\uFF0C\u4E0B\u6B21 stop \u4F1A\u518D\u6B21\u5C1D\u8BD5`));
|
|
5102
5139
|
}
|
|
5103
5140
|
function clearPid() {
|
|
5104
|
-
if (!fs8.existsSync(PATHS.pidFile)) return null;
|
|
5105
|
-
if (isPidFileOwnedByRoot()) {
|
|
5106
|
-
const result = spawnSync4("sudo", ["rm", "-f", PATHS.pidFile], { stdio: "inherit", timeout: SUDO_TIMEOUT_MS });
|
|
5107
|
-
if (result.status === 1) return "cancelled";
|
|
5108
|
-
if (result.error || result.status !== 0) {
|
|
5109
|
-
console.warn("\u8B66\u544A: root \u5C5E\u4E3B\u7684 pid \u6587\u4EF6\u672A\u80FD\u6E05\u7406\uFF08sudo \u5931\u8D25\u6216\u5DF2\u53D6\u6D88\uFF09\uFF0C\u4E0B\u6B21 stop \u4F1A\u518D\u6B21\u5C1D\u8BD5");
|
|
5110
|
-
return "failed";
|
|
5111
|
-
}
|
|
5112
|
-
return null;
|
|
5113
|
-
}
|
|
5114
5141
|
try {
|
|
5115
5142
|
fs8.unlinkSync(PATHS.pidFile);
|
|
5116
|
-
|
|
5143
|
+
return null;
|
|
5144
|
+
} catch (e) {
|
|
5145
|
+
if (e.code === "ENOENT") return null;
|
|
5146
|
+
return e;
|
|
5117
5147
|
}
|
|
5118
|
-
|
|
5148
|
+
}
|
|
5149
|
+
async function waitUntilNoMihomo() {
|
|
5150
|
+
for (let i = 0; i < PROCESS_WAIT_ATTEMPTS; i++) {
|
|
5151
|
+
if (getMihomoPids().length === 0) return;
|
|
5152
|
+
await sleep(PROCESS_WAIT_INTERVAL);
|
|
5153
|
+
}
|
|
5154
|
+
}
|
|
5155
|
+
async function reapPidWhenQuiet() {
|
|
5156
|
+
await waitUntilNoMihomo();
|
|
5157
|
+
if (getMihomoPids().length > 0) return null;
|
|
5158
|
+
return clearPid();
|
|
5119
5159
|
}
|
|
5120
5160
|
function killProcess(pid) {
|
|
5121
5161
|
try {
|
|
@@ -5141,7 +5181,6 @@ function buildKernelCleanupScript() {
|
|
|
5141
5181
|
`pkill -9 -f ${shellQuote(MAIN_INSTANCE_PATTERN)} 2>/dev/null`,
|
|
5142
5182
|
"rc=$?",
|
|
5143
5183
|
"[ $rc -le 1 ] || exit 2",
|
|
5144
|
-
`rm -f ${shellQuote(PATHS.pidFile)} 2>/dev/null || true`,
|
|
5145
5184
|
"exit 0",
|
|
5146
5185
|
""
|
|
5147
5186
|
].join("\n");
|
|
@@ -5149,13 +5188,14 @@ function buildKernelCleanupScript() {
|
|
|
5149
5188
|
async function cleanupAll() {
|
|
5150
5189
|
const pids = getMihomoPids();
|
|
5151
5190
|
if (pids.length === 0) {
|
|
5152
|
-
return { killed: 0, failed: 0, remaining: [],
|
|
5191
|
+
return { killed: 0, failed: 0, remaining: [], scriptError: null, pidError: clearPid() };
|
|
5153
5192
|
}
|
|
5154
5193
|
let killedCount = 0;
|
|
5155
5194
|
const failedPids = [];
|
|
5156
|
-
let
|
|
5157
|
-
|
|
5158
|
-
|
|
5195
|
+
let scriptError = null;
|
|
5196
|
+
const rootPids = pids.filter(isProcessRoot);
|
|
5197
|
+
if (rootPids.length > 0) {
|
|
5198
|
+
console.log(`\u68C0\u6D4B\u5230 root \u5C5E\u4E3B\u7684\u5185\u6838\u6B8B\u7559\uFF08PID ${rootPids.join(", ")}\uFF09\uFF0C\u6E05\u7406\u9700\u8981\u4E00\u6B21\u7BA1\u7406\u5458\u5BC6\u7801`);
|
|
5159
5199
|
try {
|
|
5160
5200
|
runSudoScript(buildKernelCleanupScript(), {
|
|
5161
5201
|
action: "\u6E05\u7406\u6B8B\u7559\u8FDB\u7A0B",
|
|
@@ -5164,7 +5204,7 @@ async function cleanupAll() {
|
|
|
5164
5204
|
});
|
|
5165
5205
|
killedCount = pids.length;
|
|
5166
5206
|
} catch (e) {
|
|
5167
|
-
|
|
5207
|
+
scriptError = e;
|
|
5168
5208
|
}
|
|
5169
5209
|
} else if (pids.length > BATCH_KILL_THRESHOLD) {
|
|
5170
5210
|
if (killAllMihomo()) {
|
|
@@ -5185,13 +5225,10 @@ async function cleanupAll() {
|
|
|
5185
5225
|
}
|
|
5186
5226
|
}
|
|
5187
5227
|
}
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
}
|
|
5192
|
-
const pidError = pidCleanupError(clearPid());
|
|
5193
|
-
if (!sudoError) sudoError = pidError;
|
|
5194
|
-
return { killed: killedCount, failed: failedPids.length, remaining: getMihomoPids(), sudoError };
|
|
5228
|
+
await waitUntilNoMihomo();
|
|
5229
|
+
const remaining = getMihomoPids();
|
|
5230
|
+
const pidError = remaining.length === 0 ? clearPid() : null;
|
|
5231
|
+
return { killed: killedCount, failed: failedPids.length, remaining, scriptError, pidError };
|
|
5195
5232
|
}
|
|
5196
5233
|
async function stop() {
|
|
5197
5234
|
const allPids = getMihomoPids();
|
|
@@ -5201,8 +5238,11 @@ async function stop() {
|
|
|
5201
5238
|
return { success: true, notRunning: true };
|
|
5202
5239
|
}
|
|
5203
5240
|
const result = await cleanupAll();
|
|
5204
|
-
if (result.remaining.length === 0
|
|
5205
|
-
warnPidCleanupFailed(result.
|
|
5241
|
+
if (result.remaining.length === 0) {
|
|
5242
|
+
warnPidCleanupFailed(result.pidError);
|
|
5243
|
+
if (result.scriptError) {
|
|
5244
|
+
console.warn(colors.yellow(`\u8B66\u544A: root \u6B8B\u7559\u6E05\u7406\u672A\u5B8C\u6210\uFF08${describeSudoFailure(result.scriptError)}\uFF09\uFF0C\u8FDB\u7A0B\u76EE\u524D\u5DF2\u4E0D\u5728\uFF1B\u518D\u53D1\u73B0\u6B8B\u7559\u53EF\u91CD\u8BD5 mihomo stop`));
|
|
5245
|
+
}
|
|
5206
5246
|
}
|
|
5207
5247
|
const remaining = getMihomoPids();
|
|
5208
5248
|
if (remaining.length > 0) {
|
|
@@ -5214,7 +5254,7 @@ async function stop() {
|
|
|
5214
5254
|
return { success: true, remaining };
|
|
5215
5255
|
}
|
|
5216
5256
|
clearRuntime();
|
|
5217
|
-
return { success: true
|
|
5257
|
+
return { success: true };
|
|
5218
5258
|
}
|
|
5219
5259
|
|
|
5220
5260
|
// src/service.ts
|
|
@@ -5444,23 +5484,21 @@ async function waitUntilUnloaded(target = serviceTarget()) {
|
|
|
5444
5484
|
});
|
|
5445
5485
|
}
|
|
5446
5486
|
function buildRootResidueCleanupError(result, ctx) {
|
|
5447
|
-
const
|
|
5487
|
+
const { scriptError, pidError } = result;
|
|
5488
|
+
const cancelled = scriptError instanceof SudoAuthError;
|
|
5448
5489
|
const hasKernelResidue = result.remaining.length > 0;
|
|
5449
|
-
const
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
];
|
|
5454
|
-
hint.push(hasKernelResidue ? "\u624B\u52A8\u6E05\u7406: sudo pkill -9 mihomo" : `\u624B\u52A8\u6E05\u7406: sudo rm -f ${PATHS.pidFile}`);
|
|
5490
|
+
const pidList = `PID ${result.remaining.join(", ")}`;
|
|
5491
|
+
const residueHint = hasKernelResidue ? scriptError ? `root \u6B8B\u7559\u5185\u6838\u4ECD\u5728\u8FD0\u884C\uFF08${pidList}\uFF09\uFF0C\u53EF\u80FD\u7EE7\u7EED\u5360\u7528\u4EE3\u7406\u7AEF\u53E3` : `\u6B8B\u7559\u5185\u6838\u4ECD\u5728\u8FD0\u884C\uFF08${pidList}\uFF09\u2014\u2014\u7528\u6237\u6001\u672A\u80FD\u7EC8\u6B62\uFF0C\u4E0E\u63D0\u6743\u65E0\u5173` : scriptError ? `root \u6B8B\u7559\u6E05\u7406\u672A\u5B8C\u6210\uFF0C\u8FDB\u7A0B\u76EE\u524D\u5DF2\u4E0D\u5728\uFF08\u6B7B\u4EA1\u7B49\u5F85\u5185\u81EA\u884C\u9000\u51FA\uFF0C\u975E sudo \u6E05\u7406\uFF09${pidError ? `\uFF1B${describePidCleanupFailure(pidError)}` : ""}` : pidError ? `${describePidCleanupFailure(pidError)}: ${PATHS.pidFile}` : "root \u6B8B\u7559\u672A\u6E05\u7406\u5E72\u51C0";
|
|
5492
|
+
const hint = [ctx.mainOutcome, residueHint, `\u91CD\u65B0\u8FD0\u884C\u53EF\u518D\u6B21\u5C1D\u8BD5\u6E05\u7406: ${ctx.retryCommand}`];
|
|
5493
|
+
hint.push(hasKernelResidue || scriptError ? "\u624B\u52A8\u6E05\u7406: sudo pkill -9 mihomo" : `\u624B\u52A8\u6E05\u7406: sudo rm -f ${PATHS.pidFile}`);
|
|
5455
5494
|
if (cancelled) {
|
|
5456
5495
|
return new CliError("\u7BA1\u7406\u5458\u5BC6\u7801\u672A\u8F93\u5165\u6216\u6709\u8BEF\uFF0Croot \u6B8B\u7559\u672A\u88AB\u6E05\u7406", { label: "\u5DF2\u53D6\u6D88", hint });
|
|
5457
5496
|
}
|
|
5458
|
-
return new CliError(
|
|
5497
|
+
return new CliError(scriptError?.message ?? pidError?.message ?? "root \u6B8B\u7559\u672A\u6E05\u7406\u5E72\u51C0", { label: "\u6E05\u7406\u6B8B\u7559\u8FDB\u7A0B\u5931\u8D25", hint });
|
|
5459
5498
|
}
|
|
5460
5499
|
function classifyResidueCleanup(result) {
|
|
5461
|
-
if (result.remaining.length > 0
|
|
5462
|
-
|
|
5463
|
-
return "ok";
|
|
5500
|
+
if (result.remaining.length > 0) return result.scriptError !== null ? "throw" : "ok";
|
|
5501
|
+
return result.scriptError !== null || result.pidError !== null ? "warn" : "ok";
|
|
5464
5502
|
}
|
|
5465
5503
|
async function cleanupKernelsOrThrow(ctx) {
|
|
5466
5504
|
const result = await cleanupAll();
|
|
@@ -5626,7 +5664,6 @@ function buildLegacyCleanupScript() {
|
|
|
5626
5664
|
`rm -f ${shellQuote(PATHS.systemDaemonPlist)}`,
|
|
5627
5665
|
`chown "$SUDO_UID:$SUDO_GID" ${shellQuote(PATHS.logFile)} 2>/dev/null || true`,
|
|
5628
5666
|
`chown -R "$SUDO_UID:$SUDO_GID" ${shellQuote(DIRS.data)} 2>/dev/null || true`,
|
|
5629
|
-
`rm -f ${shellQuote(PATHS.pidFile)}`,
|
|
5630
5667
|
"exit 0",
|
|
5631
5668
|
""
|
|
5632
5669
|
].join("\n");
|
|
@@ -5641,7 +5678,7 @@ function cleanupLegacySystemInstall() {
|
|
|
5641
5678
|
codeMessages: { 3: "launchctl bootout \u672A\u80FD\u5378\u8F7D\u65E7 daemon\uFF08\u8BE6\u89C1\u4E0A\u65B9\u8F93\u51FA\uFF09" }
|
|
5642
5679
|
});
|
|
5643
5680
|
}
|
|
5644
|
-
function cleanupLegacyInstallOrThrow() {
|
|
5681
|
+
async function cleanupLegacyInstallOrThrow() {
|
|
5645
5682
|
try {
|
|
5646
5683
|
cleanupLegacySystemInstall();
|
|
5647
5684
|
} catch (e) {
|
|
@@ -5651,6 +5688,10 @@ function cleanupLegacyInstallOrThrow() {
|
|
|
5651
5688
|
hint: ["\u4E5F\u53EF\u624B\u52A8\u6E05\u7406:", ` sudo launchctl bootout system/$(basename ${PATHS.systemDaemonPlist} .plist)`, ` sudo rm -f ${PATHS.systemDaemonPlist}`]
|
|
5652
5689
|
});
|
|
5653
5690
|
}
|
|
5691
|
+
const pidError = await reapPidWhenQuiet();
|
|
5692
|
+
if (pidError) {
|
|
5693
|
+
console.warn(colors.yellow(`\u8B66\u544A: ${describePidCleanupFailure(pidError)}\uFF0C\u4E0B\u6B21 stop \u4F1A\u518D\u6B21\u5C1D\u8BD5`));
|
|
5694
|
+
}
|
|
5654
5695
|
}
|
|
5655
5696
|
function logOversized() {
|
|
5656
5697
|
try {
|
|
@@ -7001,7 +7042,7 @@ async function cmdStart(args) {
|
|
|
7001
7042
|
if (detectLegacySystemInstall()) {
|
|
7002
7043
|
console.log(colors.yellow("\u68C0\u6D4B\u5230\u65E7\u7248\u672C\u5B89\u88C5\u7684\u7CFB\u7EDF\u7EA7\u670D\u52A1\uFF08root LaunchDaemon\uFF09\uFF0C\u542F\u52A8 TUN \u524D\u9700\u6E05\u7406"));
|
|
7003
7044
|
console.log(colors.gray(" \u6E05\u7406\u9700\u8981\u4E00\u6B21\u7BA1\u7406\u5458\u5BC6\u7801\uFF08\u5220\u9664 root \u62E5\u6709\u7684\u6587\u4EF6\uFF09"));
|
|
7004
|
-
cleanupLegacyInstallOrThrow();
|
|
7045
|
+
await cleanupLegacyInstallOrThrow();
|
|
7005
7046
|
console.log(colors.green("\u5DF2\u6E05\u7406\u9057\u7559\u7684\u7CFB\u7EDF\u7EA7\u670D\u52A1"));
|
|
7006
7047
|
console.log("");
|
|
7007
7048
|
}
|
|
@@ -7081,7 +7122,7 @@ function assertUniqueTokens(table) {
|
|
|
7081
7122
|
}
|
|
7082
7123
|
async function dispatchSubcommand(args, table, options) {
|
|
7083
7124
|
assertUniqueTokens(table);
|
|
7084
|
-
const action = args[1];
|
|
7125
|
+
const action = args[1]?.toLowerCase();
|
|
7085
7126
|
if (action) {
|
|
7086
7127
|
const cmd = table.find((c) => c.name === action || c.aliases?.includes(action));
|
|
7087
7128
|
if (cmd) return cmd.handler(args);
|
|
@@ -8330,7 +8371,7 @@ async function cmdReset(args) {
|
|
|
8330
8371
|
console.log("\u5DF2\u53D6\u6D88");
|
|
8331
8372
|
return;
|
|
8332
8373
|
}
|
|
8333
|
-
if ((needsStop || serviceTargeted) && legacy) cleanupLegacyInstallOrThrow();
|
|
8374
|
+
if ((needsStop || serviceTargeted) && legacy) await cleanupLegacyInstallOrThrow();
|
|
8334
8375
|
if (serviceActive) {
|
|
8335
8376
|
if (serviceTargeted) await uninstallService();
|
|
8336
8377
|
else if (needsStop) await stopService();
|
|
@@ -8343,6 +8384,13 @@ async function cmdReset(args) {
|
|
|
8343
8384
|
hint: ["\u8BF7\u624B\u52A8\u8FD0\u884C: sudo pkill -9 mihomo"]
|
|
8344
8385
|
});
|
|
8345
8386
|
}
|
|
8387
|
+
if (classifyResidueCleanup(cleanup) === "warn") {
|
|
8388
|
+
const reason = cleanup.scriptError ? `root \u6B8B\u7559\u6E05\u7406\u672A\u5B8C\u6210\uFF08${describeSudoFailure(cleanup.scriptError)}\uFF09\uFF0C\u53EF\u80FD\u4ECD\u6709\u6B8B\u7559\u8FDB\u7A0B` : cleanup.pidError ? describePidCleanupFailure(cleanup.pidError) : null;
|
|
8389
|
+
if (reason) {
|
|
8390
|
+
console.warn(colors.yellow(`\u8B66\u544A: ${reason}`));
|
|
8391
|
+
console.warn(colors.gray("\u91CD\u8BD5\u6E05\u7406: mihomo stop"));
|
|
8392
|
+
}
|
|
8393
|
+
}
|
|
8346
8394
|
recordServiceStopped();
|
|
8347
8395
|
}
|
|
8348
8396
|
const deleted = /* @__PURE__ */ new Set();
|
|
@@ -8394,7 +8442,7 @@ async function handleLegacyInstall() {
|
|
|
8394
8442
|
console.log(colors.gray(" \u5B83\u4F1A\u4E0E\u65B0\u7684\u7528\u6237\u7EA7\u670D\u52A1\u62A2\u5360\u540C\u4E00\u7EC4\u7AEF\u53E3\uFF0C\u9700\u5148\u6E05\u7406"));
|
|
8395
8443
|
console.log(colors.gray(" \u6E05\u7406\u9700\u8981\u4E00\u6B21\u7BA1\u7406\u5458\u5BC6\u7801\uFF08\u5220\u9664 root \u62E5\u6709\u7684\u6587\u4EF6\uFF09"));
|
|
8396
8444
|
console.log("");
|
|
8397
|
-
cleanupLegacyInstallOrThrow();
|
|
8445
|
+
await cleanupLegacyInstallOrThrow();
|
|
8398
8446
|
console.log(`${colors.green("\u5DF2\u6E05\u7406\u9057\u7559\u7684\u7CFB\u7EDF\u7EA7\u670D\u52A1")}`);
|
|
8399
8447
|
console.log("");
|
|
8400
8448
|
}
|
|
@@ -8464,7 +8512,7 @@ async function cmdUninstall(args) {
|
|
|
8464
8512
|
}
|
|
8465
8513
|
if (legacy) {
|
|
8466
8514
|
console.log(colors.gray("\u68C0\u6D4B\u5230\u65E7\u7248\u672C\u7684\u7CFB\u7EDF\u7EA7\u670D\u52A1\uFF0C\u6E05\u7406\u9700\u8981\u4E00\u6B21\u7BA1\u7406\u5458\u5BC6\u7801"));
|
|
8467
|
-
cleanupLegacyInstallOrThrow();
|
|
8515
|
+
await cleanupLegacyInstallOrThrow();
|
|
8468
8516
|
console.log(colors.green("\u5DF2\u6E05\u7406\u9057\u7559\u7684\u7CFB\u7EDF\u7EA7\u670D\u52A1"));
|
|
8469
8517
|
}
|
|
8470
8518
|
const remaining = getMihomoPids();
|
|
@@ -8492,7 +8540,7 @@ async function cmdStop(args) {
|
|
|
8492
8540
|
if (detectLegacySystemInstall()) {
|
|
8493
8541
|
console.log(colors.yellow("\u68C0\u6D4B\u5230\u65E7\u7248\u672C\u5B89\u88C5\u7684\u7CFB\u7EDF\u7EA7\u670D\u52A1\uFF08root LaunchDaemon\uFF09\uFF0C\u505C\u6B62\u524D\u9700\u6E05\u7406"));
|
|
8494
8542
|
console.log(colors.gray(" \u6E05\u7406\u9700\u8981\u4E00\u6B21\u7BA1\u7406\u5458\u5BC6\u7801\uFF08\u5220\u9664 root \u62E5\u6709\u7684\u6587\u4EF6\uFF09"));
|
|
8495
|
-
cleanupLegacyInstallOrThrow();
|
|
8543
|
+
await cleanupLegacyInstallOrThrow();
|
|
8496
8544
|
console.log(colors.green("\u5DF2\u6E05\u7406\u9057\u7559\u7684\u7CFB\u7EDF\u7EA7\u670D\u52A1"));
|
|
8497
8545
|
console.log("");
|
|
8498
8546
|
}
|
|
@@ -8708,14 +8756,14 @@ async function subRemove(args) {
|
|
|
8708
8756
|
assertPositionalCount(args, 1, 2, "mihomo sub remove <name>");
|
|
8709
8757
|
const name = getNonFlagArg(args, 2);
|
|
8710
8758
|
const subs = getSubscriptions();
|
|
8759
|
+
if (subs.length === 0) {
|
|
8760
|
+
throw new CliError("\u6CA1\u6709\u8BA2\u9605\uFF0C\u8BF7\u5148\u6DFB\u52A0\u8BA2\u9605", { hint: "mihomo sub add <url> [name]" });
|
|
8761
|
+
}
|
|
8711
8762
|
if (!name) {
|
|
8712
8763
|
throw new CliError("\u8BF7\u6307\u5B9A\u8981\u5220\u9664\u7684\u8BA2\u9605\u540D\u79F0", {
|
|
8713
|
-
hint:
|
|
8764
|
+
hint: ["", "\u53EF\u7528\u8BA2\u9605:", ...subs.map((s) => ` ${s.name}`)]
|
|
8714
8765
|
});
|
|
8715
8766
|
}
|
|
8716
|
-
if (subs.length === 0) {
|
|
8717
|
-
throw new CliError("\u6CA1\u6709\u8BA2\u9605\uFF0C\u8BF7\u5148\u6DFB\u52A0\u8BA2\u9605", { hint: "mihomo sub add <url> [name]" });
|
|
8718
|
-
}
|
|
8719
8767
|
const target = resolveSubscription(subs, name);
|
|
8720
8768
|
const isExact = target.name === name;
|
|
8721
8769
|
const skipConfirm = hasFlag(args, "-y", "--yes");
|
|
@@ -8881,7 +8929,7 @@ var COMMANDS = [
|
|
|
8881
8929
|
aliases: [],
|
|
8882
8930
|
handler: cmdLogs,
|
|
8883
8931
|
group: "interface",
|
|
8884
|
-
usage: [{ signature: "logs [-f] [-n N] [\u7F16\u53F7] [-o]", description: "\u65E5\u5FD7\u5217\u8868/\u67E5\u770B\
|
|
8932
|
+
usage: [{ signature: "logs [-f] [-n N] [\u7F16\u53F7] [-o]", description: "\u65E5\u5FD7\u5217\u8868/\u67E5\u770B\uFF08\u88F8 logs \u5217\u5217\u8868\uFF1B0=\u5F53\u524D\uFF0C1+=\u5F52\u6863\uFF1B\u7701\u7565\u7F16\u53F7\u4F46\u7ED9 -f/-n/-o \u65F6\u5373\u5F53\u524D\uFF09" }]
|
|
8885
8933
|
},
|
|
8886
8934
|
// === 订阅 ===
|
|
8887
8935
|
{
|
|
@@ -8900,7 +8948,7 @@ var COMMANDS = [
|
|
|
8900
8948
|
group: "subscription",
|
|
8901
8949
|
usage: [
|
|
8902
8950
|
{ signature: "subscription", description: "\u5217\u51FA\u6240\u6709\u8BA2\u9605\uFF08\u522B\u540D sub/subs\uFF09" },
|
|
8903
|
-
{ signature: "subscription use <name>", description: "\u5207\u6362\u5F53\u524D\u8BA2\u9605" },
|
|
8951
|
+
{ signature: "subscription use <name>", description: "\u5207\u6362\u5F53\u524D\u8BA2\u9605\uFF08\u81EA\u52A8\u91CD\u542F\uFF1B\u91CD\u542F\u900F\u4F20 -s/-u \u7B49\u542F\u52A8\u9009\u9879\uFF09" },
|
|
8904
8952
|
{ signature: "subscription add <url> [name]", description: "\u6DFB\u52A0\u8BA2\u9605" },
|
|
8905
8953
|
{ signature: "subscription update [name]", description: "\u66F4\u65B0\u8BA2\u9605\uFF08\u65E0\u53C2\u66F4\u65B0\u6240\u6709\uFF09" },
|
|
8906
8954
|
{ signature: "subscription remove <name>", description: "\u5220\u9664\u8BA2\u9605\uFF08\u6A21\u7CCA\u5339\u914D\u9700\u786E\u8BA4\uFF0C-y \u8DF3\u8FC7\uFF09" }
|
|
@@ -8976,7 +9024,7 @@ var COMMANDS = [
|
|
|
8976
9024
|
aliases: ["-v", "--version"],
|
|
8977
9025
|
handler: printVersion,
|
|
8978
9026
|
group: "meta",
|
|
8979
|
-
usage: [{ signature: "version
|
|
9027
|
+
usage: [{ signature: "version", description: "\u663E\u793A\u7248\u672C" }]
|
|
8980
9028
|
}
|
|
8981
9029
|
];
|
|
8982
9030
|
var COMMAND_INDEX = (() => {
|