feat: update ssh.ts

This commit is contained in:
2026-01-25 10:20:51 +08:00
parent 1e8f414944
commit a247012168

View File

@@ -7,6 +7,7 @@ import {parseArgs} from "node:util";
import fs from "node:fs"; import fs from "node:fs";
import os from "node:os"; import os from "node:os";
import JSON5 from "json5";
// reference: https://bun.com/docs/runtime/color // reference: https://bun.com/docs/runtime/color
const GREEN = Bun.color("green", "ansi"); const GREEN = Bun.color("green", "ansi");
@@ -97,7 +98,7 @@ function loadSshConfig(): SshConfig {
const configFile = os.homedir() + "/.config/ssh-rs-config.json"; const configFile = os.homedir() + "/.config/ssh-rs-config.json";
try { try {
const sshConfigText = fs.readFileSync(configFile, "utf8"); const sshConfigText = fs.readFileSync(configFile, "utf8");
return JSON.parse(sshConfigText); return JSON5.parse(sshConfigText);
} catch (e) { } catch (e) {
console.error(`Load config file: ${configFile} failed.`, e); console.error(`Load config file: ${configFile} failed.`, e);
} }
@@ -211,5 +212,5 @@ async function main() {
} }
await main(); await main();
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260123T010039+08:00.MEYCIQCiVexBU7NyQo5LWv5F // @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260125T102036+08:00.MEUCIQCn1lxyOA9IK2wnLoXD
// /mzpbGJiduFHzzhEg/9FB5Y8ZQIhAN21S6dCoghgEJCS+MFZejEF2w7PUwSZMp2r92cUUGqO // 6OjOe3m+V1ZZIwc461wTqQKmsgIgDdRvAsi2Dxvrk1bKXelGeboeO1J3aRdEB/FMPqsXS8Q=