From 7c960e5b1bf6c0d6c27a26ec01d2dc3c23a7ae34 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Mon, 26 Jan 2026 00:46:53 +0800 Subject: [PATCH] update ssh.ts --- script-meta-v2.json | 6 +++--- single-scripts/ssh.ts | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/script-meta-v2.json b/script-meta-v2.json index 7ec2aa7..77f9f6e 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -202,12 +202,12 @@ }, "ssh.ts": { "script_name": "ssh.ts", - "script_length": 6806, - "script_sha256": "1d0e457f1247ba1524a6e11d99bbc79e26d94783bbaf51de0aa9e38f0b3d3985", + "script_length": 6813, + "script_sha256": "d65f2335b82fc5f5376f1df34057d9feae12fe5f74dbfb572ce18f9a089b3a3a", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/ssh.ts", "single_script_file": true, "publish_time": 1768111677531, - "update_time": 1769318306584 + "update_time": 1769359601445 }, "wget.ts": { "script_name": "wget.ts", diff --git a/single-scripts/ssh.ts b/single-scripts/ssh.ts index bb97f38..1458318 100755 --- a/single-scripts/ssh.ts +++ b/single-scripts/ssh.ts @@ -2,8 +2,8 @@ // reference: https://git.hatter.ink/rust-scripts/scriptbase/src/branch/main/ssh-rs/src/main.rs -import {spawn} from "node:child_process"; -import {parseArgs} from "node:util"; +import { spawn } from "node:child_process"; +import { parseArgs } from "node:util"; import fs from "node:fs"; import os from "node:os"; @@ -26,7 +26,7 @@ interface SshConfig { default_forward_agent?: boolean; default_proxy?: boolean; default_username?: string; - profiles: Map; + profiles: Record; } interface SshProfile { @@ -100,11 +100,11 @@ function loadSshConfig(): SshConfig { const sshConfigText = fs.readFileSync(configFile, "utf8"); return JSON5.parse(sshConfigText); } catch (e) { - console.error(`Load config file: ${configFile} failed.`, e); + throw `Load config file: ${configFile} failed: ${e}`; } } -function matchProfile(sshConfig: SshConfig, host: string): SshProfile { +function matchProfile(sshConfig: SshConfig, host: string): SshProfile | null { let profiles = []; for (const k in sshConfig.profiles) { const sshProfile = sshConfig.profiles[k]; @@ -212,5 +212,5 @@ async function main() { } await main(); -// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260125T102036+08:00.MEUCIQCn1lxyOA9IK2wnLoXD -// 6OjOe3m+V1ZZIwc461wTqQKmsgIgDdRvAsi2Dxvrk1bKXelGeboeO1J3aRdEB/FMPqsXS8Q= +// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260126T004612+08:00.MEQCIFxHjeu7+pkPpSWVoCTb +// BbzbHhc+dsAG6vqx+i0H8MqLAiAYcK0dcCVECG1je0Q/ZCIYohHCNrvDIOr3kiNj7XWoXg==