Skip to content

Commit

Permalink
Merge pull request #137 from CosmosJunk/fixbranch
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
Last-Order authored Oct 19, 2024
2 parents 4848ad0 + 4f90d35 commit e1df8ed
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/core/archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,8 @@ class ArchiveDownloader extends Downloader {
this.allDownloadTasks = previousTask.allDownloadTasks;
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
4 changes: 2 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.enableDebugMode();
logger.setDebugMode(true);
}
if (!options.noProxy && !process.env.NO_PROXY) {
if (process.platform === "win32") {
Expand Down Expand Up @@ -125,7 +125,7 @@ Erii.bind(
},
(ctx, options) => {
if (options.verbose) {
logger.enableDebugMode();
logger.setDebugMode(true);
}
const fileOptions = readConfigFile();
if (Object.keys(fileOptions).length > 0) {
Expand Down
8 changes: 6 additions & 2 deletions src/utils/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ class ConsoleLogger {
console.info(chalk.red(`[MINYAMI][ERROR] ${message}`));
}

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/utils/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import logger from "./log";

export const exec = util.promisify(require("child_process").exec);

export const sleep = (deley) => new Promise((resolve) => setTimeout(resolve, deley));
export const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay));

export const deleteDirectory = (directoryPath: string, fileList: string[] = []) => {
for (const filename of fileList) {
Expand Down

0 comments on commit e1df8ed

Please sign in to comment.