From 86d2b0b3f63bae48fc7de40404fcca3a26900c9f Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 19 Jan 2025 16:29:43 +0800 Subject: [PATCH] feat: update ssh-verify.ts, wget.ts --- script-meta-v2.json | 8 ++++---- single-scripts/ssh-verify.ts | 2 +- single-scripts/wget.ts | 15 ++++++++------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/script-meta-v2.json b/script-meta-v2.json index d200d6c..40f3e62 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -53,19 +53,19 @@ "ssh-verify.ts": { "script_name": "ssh-verify.ts", "script_length": 2718, - "script_sha256": "03a9eec40f27821593eb4c323e29be1d7222f3d3922a0b6bdbdbcb257332db6c", + "script_sha256": "f1e9235d2511b269d87720f5f70b33d6c040f1eb0e792f2a0b2e93270415a496", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/ssh-verify.ts", "single_script_file": true, "publish_time": 1737272626141, - "update_time": 1737275173262 + "update_time": 1737275365029 }, "wget.ts": { "script_name": "wget.ts", "script_length": 3848, - "script_sha256": "02108963e530b4ae422172f93e373858e89206cfeb6b6df4ea74105600ee3a45", + "script_sha256": "578ed1fd22367956446ed44bb8951cf1e66f04e15000aac79e7e42d1694c165e", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/wget.ts", "single_script_file": true, "publish_time": 1737272626139, - "update_time": 1737272626139 + "update_time": 1737275365028 } } \ No newline at end of file diff --git a/single-scripts/ssh-verify.ts b/single-scripts/ssh-verify.ts index 13ec51f..30e6aff 100755 --- a/single-scripts/ssh-verify.ts +++ b/single-scripts/ssh-verify.ts @@ -3,7 +3,7 @@ import { parseArgs } from "jsr:@std/cli/parse-args"; import { log, -} from "https://hatter.ink/script/fetch/library/deno-commons-mod.ts?202401191623"; +} from "https://hatter.ink/script/fetch/library/deno-commons-mod.ts?202501191623"; import { fetchKeys, SshKey, diff --git a/single-scripts/wget.ts b/single-scripts/wget.ts index c648df5..5b71e6a 100755 --- a/single-scripts/wget.ts +++ b/single-scripts/wget.ts @@ -4,14 +4,15 @@ // - https://docs.deno.com/examples/command_line_arguments/ // - https://jsr.io/@chiba/wget/1.0.0/mod.ts -import {parseArgs} from "jsr:@std/cli/parse-args"; +import { parseArgs } from "jsr:@std/cli/parse-args"; import { clearLastLine, formatHumanTime, formatPercent, formatSize2, + log, printLastLine, -} from "https://hatter.ink/script/fetch/library/deno-commons-mod.ts?202401191305"; +} from "https://hatter.ink/script/fetch/library/deno-commons-mod.ts?202501191305"; function getOutputFilename(filename: string): string { const original = filename; @@ -55,7 +56,7 @@ const flags = parseArgs(Deno.args, { }); if (args.length === 0) { - console.log(`wget.ts --help for help`); + log.info(`wget.ts --help for help`); Deno.exit(1); } if (flags.help) { @@ -66,7 +67,7 @@ wget.ts [--proxy socks5h://ip:port] [--no-proxy] [--output filename] `); } if (flags._.length === 0) { - console.log("Require URL."); + log.error("Require URL."); Deno.exit(1); } @@ -76,7 +77,7 @@ const outputFilename = flags.output || getOutputFilenameFromUrl(url); const startTime = new Date().getTime(); let totalLength: number = -2; -console.log(`Start download file: ${url} --> ${outputFilename}`); +log.info(`Start download file: ${url} --> ${outputFilename}`); const stateFileInterVal = setInterval(async () => { const costTime = new Date().getTime() - startTime; @@ -104,7 +105,7 @@ let init = undefined; const noProxy = flags["no-proxy"]; const proxy = flags.proxy || getEnvironmentProxy(); if (proxy && !noProxy) { - console.log(`Using proxy: ${proxy}`); + log.info(`Using proxy: ${proxy}`); init = { client: Deno.createHttpClient({ proxy: { @@ -130,7 +131,7 @@ await clearLastLine(); const costTime = new Date().getTime() - startTime; const fileInfo = await Deno.stat(outputFilename); const fileSize = fileInfo.size; -console.log( +log.success( `Download finished, size: ${formatSize2(fileSize)}, time: ${ formatHumanTime(costTime) }`,