(problemNode: IProblem, language: string, filePath: string, showDescriptionInComment: boolean = false, needTranslation: boolean)
| 101 | } |
| 102 | |
| 103 | public async showProblem(problemNode: IProblem, language: string, filePath: string, showDescriptionInComment: boolean = false, needTranslation: boolean): Promise<void> { |
| 104 | const templateType: string = showDescriptionInComment ? "-cx" : "-c"; |
| 105 | const cmd: string[] = [await this.getLeetCodeBinaryPath(), "show", problemNode.id, templateType, "-l", language]; |
| 106 | |
| 107 | if (!needTranslation) { |
| 108 | cmd.push("-T"); // use -T to force English version |
| 109 | } |
| 110 | |
| 111 | if (!await fse.pathExists(filePath)) { |
| 112 | await fse.createFile(filePath); |
| 113 | const codeTemplate: string = await this.executeCommandWithProgressEx("Fetching problem data...", this.nodeExecutable, cmd); |
| 114 | await fse.writeFile(filePath, codeTemplate); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * This function returns solution of a problem identified by input |
no test coverage detected