mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2026-10-25 17:36:37 +08:00
新建命令时按执行方式填上默认图标
MCP 建出来的命令 features.icon 是空的,命令卡片上就是个空位。现在 icon 留空时 按 program 填对应语言的默认图标(shell -> logo/shell.png、python -> logo/python.png,编排用内置图标),显式传了 icon 就用传入的。
This commit is contained in:
1 parent
935b943b6a
commit
f2abe34dac
4 files changed
+43
-2
No files matched your search
@@ -45,6 +45,22 @@ const code = command.features.code;
|
||||
assert.match(code, /^key_[0-9a-f]{8}$/);
|
||||
assert.strictEqual(command.features.cmds[0], "测试命令");
|
||||
assert.strictEqual(command.features.mainHide, false);
|
||||
// 不带图标时用该执行方式的默认图标
|
||||
assert.strictEqual(command.features.icon, "logo/quickcommand.png");
|
||||
const pyCommand = store.create({
|
||||
program: "python",
|
||||
cmd: "print(1)",
|
||||
features: { explain: "py", cmds: ["py"] },
|
||||
}).command;
|
||||
assert.strictEqual(pyCommand.features.icon, "logo/python.png");
|
||||
const customCommand = store.create({
|
||||
program: "custom",
|
||||
cmd: "x",
|
||||
features: { explain: "自定义", cmds: ["自定义"], icon: "data:image/png;base64,xxx" },
|
||||
}).command;
|
||||
assert.strictEqual(customCommand.features.icon, "data:image/png;base64,xxx");
|
||||
store.remove(pyCommand.features.code);
|
||||
store.remove(customCommand.features.code);
|
||||
assert.ok(db.has("qc_" + code));
|
||||
assert.ok(features.has(code));
|
||||
|
||||
|
||||
Reference in new issue
Block a user