lcode 0.1.1

Mediocre leetcode cli client.
Documentation

A toy project

Install

cargo install lcode

Useage

Generate configuration, manual modification of the configuration is also possible, and it will be automatically generated at runtime. Without -c, it will be generated in English.

lcode gencon -c

Synchronize basic data first.

lcode sync

View the documentation for assistance.

lcode -h

Begin selecting a question.

lcode fzy <edit>

Configuration

The configuration is located at ~/.config/leetcode-cn-en-cli/config.toml

tongue = "cn"
column = 4
num_sublist = 10
page_size = 25
editor = ["vim"]
lang = "rust"
code_dir = "/home/user/.local/share/leetcode-cn-en-cli"

[urls]
origin = "https://leetcode.cn"
graphql = "https://leetcode.cn/graphql"
all_problem_api = "https://leetcode.cn/api/problems/$category"
submit = "https://leetcode.cn/problems/$slug/submit/"
test = "https://leetcode.cn/problems/$slug/interpret_solution/"
submissions = "https://leetcode.cn/submissions/detail/$id/check/"
favorites = "https://leetcode.cn/list/api/questions"

[support_lang]
langs = ["rust", "bash", "c", "cpp", "csharp", "golang", "java", "javascript", "kotlin", "mysql", "php", "python", "python3", "ruby", "scala", "swift", "typescript", "racket", "erlang", "elixir", "dart"]

[cookies]
csrf = ""
session = ""

First

Press F12 on the browser's leetcode.com/cn page, Find the cookie field, copy the csrf and session sections inside it into the configuration.

Here are the explanations for each field

Fill in either cn or en, with en being the default.

tongue = "cn"

When retrieving the submissionlist, how many columns should be displayed.

column = 4

How many recent entries of the submissionlist information should be displayed.

num_sublist = 10

How many questions should be displayed at once when interactively selecting a question.

page_size = 25

Fill in your editor, it will attempt to retrieve it from the environment variables EDITOR and VISUAL, otherwise it will default to vim.

editor = ["vim"]

You can add additional parameters at the end.

editor = ["vim", "--noplugin"]

Set your selected programming language.

lang = "rust"

Set the location for storing code and test cases.

code_dir = "/home/user/.local/share/leetcode-cn-en-cli"