feat: update wget.ts

This commit is contained in:
2025-01-19 13:27:15 +08:00
parent e5a2977162
commit 294d523039
2 changed files with 6 additions and 5 deletions

View File

@@ -51,7 +51,7 @@ function getEnvironmentProxy(): string | undefined {
const args = Deno.args;
const flags = parseArgs(Deno.args, {
boolean: ["help"],
boolean: ["help", "no-proxy"],
string: ["proxy", "output"],
});
@@ -62,7 +62,7 @@ if (args.length === 0) {
if (flags.help) {
console.log(`wget.ts - download file
wget.ts <URL>`);
wget.ts [--proxy socks5h://ip:port] [--no-proxy] [--output filename] <URL>`);
Deno.exit(0);
}
@@ -102,8 +102,9 @@ const stateFileInterVal = setInterval(async () => {
const outputFileWritable = Deno.createSync(outputFilename).writable;
let init = undefined;
const noProxy = flags["no-proxy"];
const proxy = flags.proxy || getEnvironmentProxy();
if (proxy) {
if (proxy && !noProxy) {
console.log(`Using proxy: ${proxy}`);
init = {
client: Deno.createHttpClient({