{"id":15043986,"url":"https://github.com/saying121/lcode","last_synced_at":"2025-10-23T17:31:31.676Z","repository":{"id":185083877,"uuid":"670007788","full_name":"saying121/lcode","owner":"saying121","description":" An application of terminal write leetcode.一个终端刷力扣的应用。","archived":false,"fork":false,"pushed_at":"2024-09-13T11:54:29.000Z","size":3627,"stargazers_count":14,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T21:24:55.257Z","etag":null,"topics":["algorithm","cli","leetcode","ratatui-rs","rust","tui"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/lcode","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saying121.png","metadata":{"files":{"readme":"README-CN.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-24T05:06:38.000Z","updated_at":"2024-09-13T11:44:49.000Z","dependencies_parsed_at":"2023-10-01T11:47:05.011Z","dependency_job_id":"29addfda-edfd-4205-82e5-909a2ff86f69","html_url":"https://github.com/saying121/lcode","commit_stats":{"total_commits":308,"total_committers":5,"mean_commits":61.6,"dds":0.5551948051948052,"last_synced_commit":"425a5a8e80208355503844d1a0025302114a12f0"},"previous_names":["saying121/leetcode-cn-en-cli","saying121/lcode"],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saying121%2Flcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saying121%2Flcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saying121%2Flcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saying121%2Flcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saying121","download_url":"https://codeload.github.com/saying121/lcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237868984,"owners_count":19379238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","cli","leetcode","ratatui-rs","rust","tui"],"created_at":"2024-09-24T20:49:55.482Z","updated_at":"2025-10-23T17:31:31.671Z","avatar_url":"https://github.com/saying121.png","language":"Rust","readme":"# 终端写力扣\n\n\u003c!--toc:start--\u003e\n- [终端写力扣](#终端写力扣)\n  - [功能](#功能)\n  - [安装](#安装)\n    - [可以使用以下任意一种方法安装](#可以使用以下任意一种方法安装)\n    - [更新 lcode](#更新-lcode)\n  - [使用](#使用)\n  - [视频](#视频)\n  - [配置](#配置)\n    - [Cookies 重要部分](#cookies-重要部分)\n    - [Keymap](#keymap)\n    - [LANGS](#langs)\n    - [CONFIG](#config)\n    - [各个字段的说明](#各个字段的说明)\n  - [用户信息](#用户信息)\n\u003c!--toc:end--\u003e\n\n\u003e [!WARNING]\n\u003e\n\u003e 此文档有可能更新不及时，以英文文档为准。\n\n## 功能\n\n- 调用给定的编辑器进行编辑。\n- 根据题目类别过滤。\n- 模糊搜索。\n- 修改测试用例。\n- 测试，提交代码。\n- 自动获取 cookies 省去去浏览器复制的麻烦,\n  详情：[decrypt-cookies](https://github.com/saying121/tidy-browser/tree/master/crates/decrypt-cookies#test-status)。\n\n## 安装\n\n依赖:\n\n- `sqlite`\n- `libsecret` (Linux Optional)\n- `libdbus` (Linux 通知)\n- [`mdcat`](https://github.com/swsnr/mdcat/) (渲染 markdown)\n\n构建依赖:\n\n- `gcc`\n- `pkg-config`\n- `libdbus-1-dev`\n\n### 可以使用以下任意一种方法安装\n\n\u003e [!NOTE]\n\u003e\n\u003e 添加 `~/.cargo/bin` 到 `$PATH`\n\n- 通过 [cargo-binstall](https://github.com/cargo-bins/cargo-binstall) 直接安装二进制。\n\n```bash\ncargo binstall lcode\n```\n\n- Archlinux 可以使用 AUR 助手 安装\n\nAUR 里面打包了 bash, zsh, fish 的补全脚本。\n\n```bash\nyay -S lcode-bin\n# or\nparu -S lcode-bin\n```\n\n- 去 [release](https://github.com/saying121/lcode/releases) 下载\n\n[release](https://github.com/saying121/lcode/releases)\n\n- 自己编译\n\n```shell\nrustup default nightly\ncargo install --locked --force lcode\n```\n\n### 更新 lcode\n\n使用 [cargo-update](https://github.com/nabijaczleweli/cargo-update)\n\n```bash\ncargo install-update --all\n```\n\n## 使用\n\n生成配置，手动改配置也可以，在运行时会自动生成，\n不带 `-c` 会以英文来生成\n\n```shell\nlcode gencon -c\n```\n\n先同步基本数据\n\n```shell\nlcode S\n```\n\n查看帮助文档，开始选择题目\n\n```shell\nlcode -h\nlcode fzy \u003cedit\u003e\n```\n\nShell 补全.\n\n```bash\n# zsh\necho 'eval $(lcode --generate zsh)' \u003e\u003e~/.zshrc\n# bash\necho 'eval $(lcode --generate bash)' \u003e\u003e~/.bashrc\n# ...\n```\n\n## 视频\n\n\u003chttps://github.com/saying121/lcode/assets/74663483/62b8f4cc-73dc-49db-a6a1-4823a640a13a\u003e\n\n\u003chttps://github.com/saying121/lcode/assets/74663483/9ad6ad58-b401-42f6-b8dc-359f78a37729\u003e\n\n## 配置\n\n配置位置\n\n- Linux: `~/.config/lcode/`\n- macos: `~/.config/lcode/`\n- Windows: `C:\\Users\\Alice\\AppData\\Roaming\\lcode`\n\n代码默认位置\n\n- Linux: `~/.local/share/lcode`\n- macOS: `~/Library/Application Support/lcode`\n- Windows: `C:\\Users\\Alice\\AppData\\Local\\lcode`\n\n布局:\n\n```txt\n1_two-sum/\n├── 1.cpp*\n├── 1.rs*\n├── 1_detail_cn.md*\n├── 1_detail_en.md*\n└── 1_test_case.txt*\n```\n\n缓存位置\n\n- Linux: `~/.local/share/lcode/`\n- macOS: `~/Library/Caches/lcode`\n- Windows: `C:\\Users\\user\\AppData\\Local\\lcode`\n\n### Cookies 重要部分\n\n一般来说只需要填写 `~/.config/lcode/config.toml`\n要使用这个选项，注意不要设置关闭浏览器时清空 cookies。\n\n```toml\nbrowser = \"edge\" # `chrome`, `edge`, `firefox`, `librewolf` etc.\n# 大小写无所谓, `eDgE` 也可以.\n```\n\n详情: [decrypt-cookies](https://github.com/saying121/tidy-browser/tree/master/crates/decrypt-cookies#test-status)\n\n---\n\n`~/.config/lcode/cookies.toml`\n\n```toml\ncsrf = \"\"\nsession = \"\"\n```\n\n\u003e [**首先在浏览器登陆 leetcode 来生成 cookies 。**]\n\n`[cookies]` 部分\n\n- 如果两个子字段**不为空**则使用用户填写的内容。并不会使用其他方法获取 cookies。\n\n  - 手动填写方法：\n\n    从浏览器的 `leetcode.com/cn` 页面按下 \u003ckbd\u003eF12\u003c/kbd\u003e，点击 network/网络，\n    找到 **Cookie** 字段，复制里面的 **`csrftoken`=\\\u003c$内容\\\u003e;** 和 **`LEETCODE_SESSION`=\\\u003c$内容\\\u003e;**\n    复制 **$内容** 到配置里面。\n\n- 如果填写了 `browser` ，则会尝试所填写浏览器获取 cookies 。\n\n- 以上两个都没有填写则会自动以\n  _Firefox_ -\u003e _Librewolf_ -\u003e _Chrome_ -\u003e _Edge_ -\u003e _Chromium_\n  -\u003e _Brave_ -\u003e _Yandex_ -\u003e _Vivaldi_ -\u003e _Opera_ -\u003e _OperaGX_ -\u003e _CocCoc_\n  的顺序尝试获取 cookies 。\n\n### Keymap\n\n[keymap](./KEYMAP.md)\n\n### LANGS\n\n[langs](./LANGS.md)\n\n### CONFIG\n\n运行 `lcode gencon -c` 生成配置，`lcode C` 编辑。\n\ncn 用户建议更改两处: `url_suffix = \"cn\"`, `translate = true`.\n\n```toml\n# 是否显示翻译后的内容\ntranslate = true\n\n# 填入 `com` 或者 `cn`，来设置网站后缀 `leetcode.com` 或者 `leetcode.cn`\nurl_suffix = \"cn\"\n\n# 获取 `submissionlist` 时显示几列\ncolumn = 4\n\n# 显示最后多少条 `submissionlist` 信息\nnum_sublist = 10\n\n# 交互选择题目时一次显示几道题目\npage_size = 25\n\n# 填写你的编辑器，会尝试从环境变量 `EDITOR` 和 `VISUAL` 获取，\n# 否则为 `vim`\n#\n# 魔法，使用这些编辑器或垂直分割问题和编辑器。\n#\n# - vim\n# - nvim\n# - helix\n#\n#可以在后面添加参数\n#例如 `editor = [\"vim\", \"--noplugin\"]`\neditor = [\"vim\"]\n\n# 设置你所选编程语言\nlang = \"rust\"\n\n# 设置代码和测试用例存储的位置\n# 也可以这样写，以`~`开头\n# 例如： `code_dir = \"~/.local/share/lcode\"`\ncode_dir = \"/home/user/.local/share/lcode\"\n\n# 查看 [Cookies 重要部分](#cookies-重要部分) 部分.\nbrowser = \"\"\n\n# 为了更好的写 rust。 这会添加一个 `Cargo.toml` 文件\ncargo_integr = true\n\n# 是否用 fronted id 创建代码目录\ndir_with_frontend_id = true\n\n# 是否展示头像，在kitty上工作的很好，在其他终端有可能出现问题\nshow_avatar = false\n```\n\n## 用户信息\n\n你可以查看 tui 的 info/tab3 界面来确认 cookies 是有效的.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaying121%2Flcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaying121%2Flcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaying121%2Flcode/lists"}