Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3b7a86a

Browse files
author
chengruilin
committed
refactor: Update judgment condition
1 parent 96487df commit 3b7a86a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/commands/show.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,27 @@ async function showProblemInternal(node: IProblem): Promise<void> {
5656
const outputPath: RegExpMatchArray | null = outputPathCfg.match(/\$\{(.*?)\}/);
5757
if (outputPath) {
5858
switch (outputPath[1].toLowerCase()) {
59-
case "tag": {
59+
case "tag":
6060
const closestTag: string = node.tags.reduce((prev: string, curr: string) => {
6161
return curr.length > prev.length ?
6262
curr :
6363
prev;
6464
}, "");
6565
outDir = path.join(outDir, closestTag);
6666
break;
67-
}
68-
case "language": {
67+
case "language":
6968
outDir = path.join(outDir, language);
7069
break;
71-
}
72-
case "difficulty": {
70+
case "difficulty":
7371
outDir = path.join(outDir, node.difficulty);
7472
break;
75-
}
7673
default: {
7774
break;
7875
}
7976

8077
}
78+
} else {
79+
outDir = path.join(outDir, outputPathCfg);
8180
}
8281
await fse.ensureDir(outDir);
8382
const result: string = await leetCodeExecutor.showProblem(node.id, language, outDir);

0 commit comments

Comments
 (0)