zixulu 1.73.7 → 1.74.0
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/dist/index.js +51 -1
- package/dist/index.js.map +1 -1
- package/dist/src/utils/addOpenWith.d.ts +6 -0
- package/dist/src/utils/removeOpenWith.d.ts +2 -0
- package/package.json +1 -1
- package/src/index.ts +22 -0
- package/src/utils/addOpenWith.ts +59 -0
- package/src/utils/addPrettier.ts +1 -0
- package/src/utils/removeOpenWith.ts +29 -0
- package/src/utils/syncAgentRules.ts +1 -1
- package/dist/test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1395,6 +1395,7 @@ generated
|
|
|
1395
1395
|
.next
|
|
1396
1396
|
.vscode
|
|
1397
1397
|
.generated
|
|
1398
|
+
**/components/ui/**
|
|
1398
1399
|
`;
|
|
1399
1400
|
const prettierConfig = `// @ts-check
|
|
1400
1401
|
|
|
@@ -4288,7 +4289,7 @@ async function asyncAgentRules() {
|
|
|
4288
4289
|
});
|
|
4289
4290
|
const orders = [
|
|
4290
4291
|
"base.mdc",
|
|
4291
|
-
"
|
|
4292
|
+
"react.mdc",
|
|
4292
4293
|
"api.mdc",
|
|
4293
4294
|
"next.mdc"
|
|
4294
4295
|
];
|
|
@@ -5027,6 +5028,41 @@ async function winget() {
|
|
|
5027
5028
|
if (global.__ZIXULU_PROXY__) args.push("--proxy", "http://127.0.0.1:7890");
|
|
5028
5029
|
spawnAsync("winget", args);
|
|
5029
5030
|
}
|
|
5031
|
+
async function addOpenWith(path, { file, folder, background }) {
|
|
5032
|
+
if (!file && !folder && !background) throw new Error("至少选择一个");
|
|
5033
|
+
path = external_path_resolve(path);
|
|
5034
|
+
try {
|
|
5035
|
+
const status = await stat(path);
|
|
5036
|
+
if (!status.isFile()) throw new Error("路径不是文件");
|
|
5037
|
+
} catch (error) {}
|
|
5038
|
+
const { name } = parse(path);
|
|
5039
|
+
const escapedPath = path.replace(/[\\\/]/g, "\\\\");
|
|
5040
|
+
let reg = `\ufeffWindows Registry Editor Version 5.00
|
|
5041
|
+
`;
|
|
5042
|
+
if (file) reg += `
|
|
5043
|
+
[HKEY_CLASSES_ROOT\\*\\shell\\${name}]
|
|
5044
|
+
@="使用 ${name} 打开"
|
|
5045
|
+
"Icon"="\\"${escapedPath}\\""
|
|
5046
|
+
|
|
5047
|
+
[HKEY_CLASSES_ROOT\\*\\shell\\${name}\\command]
|
|
5048
|
+
@="\\"${escapedPath}\\" \\"%1\\""`;
|
|
5049
|
+
if (folder) reg += `
|
|
5050
|
+
[HKEY_CLASSES_ROOT\\Directory\\shell\\${name}]
|
|
5051
|
+
@="使用 ${name} 打开"
|
|
5052
|
+
"Icon"="\\"${escapedPath}\\""
|
|
5053
|
+
|
|
5054
|
+
[HKEY_CLASSES_ROOT\\Directory\\shell\\${name}\\command]
|
|
5055
|
+
@="\\"${escapedPath}\\" \\"%V\\""`;
|
|
5056
|
+
if (background) reg += `
|
|
5057
|
+
[HKEY_CLASSES_ROOT\\Directory\\Background\\shell\\${name}]
|
|
5058
|
+
@="使用 ${name} 打开"
|
|
5059
|
+
"Icon"="\\"${escapedPath}\\""
|
|
5060
|
+
|
|
5061
|
+
[HKEY_CLASSES_ROOT\\Directory\\Background\\shell\\${name}\\command]
|
|
5062
|
+
@="\\"${escapedPath}\\" \\"%V\\""
|
|
5063
|
+
`;
|
|
5064
|
+
await writeFile(`add_open_with_${name}.reg`, reg, "utf-16le");
|
|
5065
|
+
}
|
|
5030
5066
|
const gdm_script = `// @ts-check
|
|
5031
5067
|
|
|
5032
5068
|
import { spawnSync } from "child_process"
|
|
@@ -5128,6 +5164,18 @@ async function gdm() {
|
|
|
5128
5164
|
await writeFile(".gdm/gdm.mjs", gdm_script);
|
|
5129
5165
|
await verdaccio();
|
|
5130
5166
|
}
|
|
5167
|
+
async function removeOpenWith(name, { file, folder, background }) {
|
|
5168
|
+
if (!file && !folder && !background) throw new Error("至少选择一个");
|
|
5169
|
+
let reg = `\ufeffWindows Registry Editor Version 5.00
|
|
5170
|
+
`;
|
|
5171
|
+
if (file) reg += `
|
|
5172
|
+
[-HKEY_CLASSES_ROOT\\*\\shell\\${name}]`;
|
|
5173
|
+
if (folder) reg += `
|
|
5174
|
+
[-HKEY_CLASSES_ROOT\\Directory\\shell\\${name}]`;
|
|
5175
|
+
if (background) reg += `
|
|
5176
|
+
[-HKEY_CLASSES_ROOT\\Directory\\Background\\shell\\${name}]`;
|
|
5177
|
+
await writeFile(`remove_open_with_${name}.reg`, reg, "utf-16le");
|
|
5178
|
+
}
|
|
5131
5179
|
setDefaultOptions({
|
|
5132
5180
|
shell: true,
|
|
5133
5181
|
stdio: "inherit"
|
|
@@ -5315,6 +5363,8 @@ program.command("replace-commit-message").alias("rcm").description("替换所有
|
|
|
5315
5363
|
});
|
|
5316
5364
|
});
|
|
5317
5365
|
program.command("gdm").description("同步 geshu-docker-management").action(gdm);
|
|
5366
|
+
program.command("add-open-with").alias("aow").description("添加打开文件的脚本").argument("path", "程序路径").option("--no-file", "是否不添加文件关联").option("--no-folder", "是否不添加文件夹关联").option("--no-background", "是否不添加文件夹空白处关联").action(addOpenWith);
|
|
5367
|
+
program.command("remove-open-with").alias("row").description("删除打开文件的脚本").argument("name", "脚本名称").option("--no-file", "是否不删除文件关联").option("--no-folder", "是否不删除文件夹关联").option("--no-background", "是否不删除文件夹空白处关联").action(removeOpenWith);
|
|
5318
5368
|
program.parse();
|
|
5319
5369
|
|
|
5320
5370
|
//# sourceMappingURL=index.js.map
|