diff --git a/src/commands/list.ts b/src/commands/list.ts index 7e7b36a..b9c2284 100644 --- a/src/commands/list.ts +++ b/src/commands/list.ts @@ -19,11 +19,11 @@ export async function listProblems(): Promise { const result: string = await leetCodeExecutor.listProblems(showLocked, useEndpointTranslation); const problems: IProblem[] = []; const lines: string[] = result.split("\n"); - const reg: RegExp = /^(.)\s(.{1,2})\s(.)\s\[\s*(\d*)\s*\]\s*(.*)\s*(Easy|Medium|Hard)\s*\((\s*\d+\.\d+ %)\)/; + const reg: RegExp = /^(.)\s(.{1,2})\s(.)\s\[\s*(\d*)\s*\]\s*(.*)\s*(Easy|Medium|Hard)\s*\((\s*\d+\.\d+ %)\)\s*(.*)/; const { companies, tags } = await leetCodeExecutor.getCompaniesAndTags(); for (const line of lines) { const match: RegExpMatchArray | null = line.match(reg); - if (match && match.length === 8) { + if (match && match.length === 9) { const id: string = match[4].trim(); problems.push({ id, @@ -33,6 +33,7 @@ export async function listProblems(): Promise { name: match[5].trim(), difficulty: match[6].trim(), passRate: match[7].trim(), + slug: match[8].trim(), companies: companies[id] || ["Unknown"], tags: tags[id] || ["Unknown"], }); diff --git a/src/commands/show.ts b/src/commands/show.ts index 3aebce8..5f29993 100644 --- a/src/commands/show.ts +++ b/src/commands/show.ts @@ -234,6 +234,8 @@ async function resolveRelativePath(relativePath: string, node: IProblem, selecte return node.id; case "name": return node.name; + case "slug": + return node.slug; case "camelcasename": return _.camelCase(node.name); case "pascalcasename": diff --git a/src/explorer/LeetCodeNode.ts b/src/explorer/LeetCodeNode.ts index 67aad32..39d209f 100644 --- a/src/explorer/LeetCodeNode.ts +++ b/src/explorer/LeetCodeNode.ts @@ -14,6 +14,9 @@ export class LeetCodeNode { public get name(): string { return this.data.name; } + public get slug(): string { + return this.data.slug; + } public get state(): ProblemState { return this.data.state; diff --git a/src/shared.ts b/src/shared.ts index e09943f..7a878ee 100644 --- a/src/shared.ts +++ b/src/shared.ts @@ -76,6 +76,7 @@ export interface IProblem { state: ProblemState; id: string; name: string; + slug: string; difficulty: string; passRate: string; companies: string[]; @@ -88,6 +89,7 @@ export const defaultProblem: IProblem = { state: ProblemState.Unknown, id: "", name: "", + slug: "", difficulty: "", passRate: "", companies: [] as string[], pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy