Skip to content

Commit

Permalink
ignore �erbose option in previous task.
Browse files Browse the repository at this point in the history
  • Loading branch information
Last-Order committed Oct 19, 2024
1 parent e1df8ed commit af683e9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
3 changes: 0 additions & 3 deletions src/core/archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@ class ArchiveDownloader extends Downloader {
this.cookies = previousTask.cookies;
this.headers = previousTask.headers;
this.key = previousTask.key;
this.verbose = previousTask.verbose;
this.startedAt = new Date().valueOf();
this.totalChunksCount = previousTask.totalChunksCount - previousTask.finishedChunksCount;
this.retries = previousTask.retries;
Expand All @@ -550,7 +549,6 @@ class ArchiveDownloader extends Downloader {
this.downloadTasks = previousTask.downloadTasks;
this.finishedFilenames = previousTask.finishedFilenames;

logger.setDebugMode(this.verbose);
if (this.headers && Object.keys(this.headers).length > 0) {
// Apply global custom headers
axios.defaults.headers.common = {
Expand Down Expand Up @@ -628,7 +626,6 @@ class ArchiveDownloader extends Downloader {
cookies: this.cookies,
headers: this.headers,
key: this.key,
verbose: this.verbose,
startedAt: this.startedAt,
finishedChunksCount: this.totalChunksCount - unfinishedTaskCount,
finishedChunkLength: this.finishedChunkLength,
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Erii.bind(
async (ctx, options) => {
const path = ctx.getArgument().toString();
if (options.verbose) {
logger.setDebugMode(true);
logger.enableDebugMode();
}
if (!options.noProxy && !process.env.NO_PROXY) {
if (process.platform === "win32") {
Expand Down Expand Up @@ -105,6 +105,9 @@ Erii.bind(
},
async (ctx, options) => {
const path = ctx.getArgument().toString();
if (options.verbose) {
logger.enableDebugMode();
}
const downloader = new ArchiveDownloader(undefined, {
cliMode: true,
});
Expand All @@ -125,7 +128,7 @@ Erii.bind(
},
(ctx, options) => {
if (options.verbose) {
logger.setDebugMode(true);
logger.enableDebugMode();
}
const fileOptions = readConfigFile();
if (Object.keys(fileOptions).length > 0) {
Expand Down
8 changes: 2 additions & 6 deletions src/utils/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ class ConsoleLogger {
console.info(chalk.red(`[MINYAMI][ERROR] ${message}`));
}

setDebugMode(enabled: boolean): void {
this.isDebugMode = enabled;
}

isDebugEnabled(): boolean {
return this.isDebugMode;
enableDebugMode() {
this.isDebugMode = true;
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/utils/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ export interface MinyamiTask {
headers: Record<string, string>;
key: string;

/** 是否打印调试信息 */
verbose: boolean;

/** 开始下载时间 */
startedAt: number;
/** 已完成的块数量 */
Expand Down

0 comments on commit af683e9

Please sign in to comment.