Skip to content

Commit 9abdbb8

Browse files
docs: fix bugs and update README
1 parent 030444b commit 9abdbb8

File tree

4 files changed

+51
-18
lines changed

4 files changed

+51
-18
lines changed

README.md

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,57 @@
1-
### Leetcode CLI
1+
# LeetCode CLI
22

3-
A command-line interface tool for LeetCode that helps you practice coding problems directly from your terminal. This CLI application streamlines the process of accessing, solving, and submitting LeetCode problems without leaving your development environment.
3+
A sleek command-line tool for LeetCode - solve, test, and submit problems directly from your terminal.
44

5-
### Commands
6-
- `lc login` - Login to your LeetCode account
7-
- `lc logout` - Logout from your LeetCode account
8-
- `lc profile` - Show your LeetCode profile
9-
- `lc daily` - Show today's daily challenge
10-
- `lc list` - List all problems
11-
- `lc show` - Show problem details
12-
- `lc test` - Test your solution
13-
- `lc test` - Test your solution
14-
- `lc submit` - Submit your solution
15-
- `lc edit` - Edit your solution
5+
### Preview
166

17-
### Installation
7+
![Comming soon](https://example.com)
188

9+
### 🚀 Quick Start
10+
11+
#### 1. Using pip
12+
```bash
13+
pip install leetcode-cli
14+
```
15+
16+
#### 2. clone the repository
1917
```bash
2018
git clone https://github.com/yuvrajsinh5252/leetcode-cli
19+
```
20+
21+
```bash
2122
cd leetcode-cli
2223
python -m venv .venv
2324
source ./.venv/bin/activate
2425
pip install -r requirements.txt
2526
pip install -e .
2627
```
2728

28-
Currently under development. More features and documentation will be added soon.
29+
### Available Commands
30+
31+
| Command | Description | Options |
32+
|---------|-------------|----------|
33+
| `lc login` | Login to LeetCode account | - |
34+
| `lc logout` | Logout from LeetCode | - |
35+
| `lc profile` | Display LeetCode profile | - |
36+
| `lc daily` | Show today's challenge | `{lang}` - Language (optional)<br>`-e EDITOR` - Preferred editor |
37+
| `lc list` | List all problems | `-d` - Difficulty<br>`-s` - Status<br>`-t` - Tag<br>`-c` - Category |
38+
| `lc show` | Display problem details | `{Problem Name/Number}` |
39+
| `lc test` | Test your solution | `{Problem Name/Number} {FILE}` |
40+
| `lc submit` | Submit your solution | `{Problem Name/Number} {FILE}` |
41+
| `lc edit` | Edit solution in editor | `{Problem Name/Number} {lang} [-e EDITOR]` |
42+
43+
### Usage Examples
44+
45+
```bash
46+
lc list -d easy -s attempted -t array
47+
lc edit 1 py # edit problem 1 in python
48+
lc test 1 two-sum.py
49+
lc submit 1 two-sum.py
50+
```
51+
### 🚧 Work in Progress
52+
53+
#### Todo
54+
- [ ] Implement test case management
55+
- [ ] Add support for custom test cases
56+
- [ ] Improve error handling
57+
- [ ] Add solution templates

src/commands/daily.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
from ..server.api import get_daily_question
44

55
def daily(
6-
lang: str = typer.Argument("python", help="Programming language to use."),
6+
lang: str = typer.Argument("py", help="Programming language to use."),
77
editor: str = typer.Option("code", '-e', help="Code editor to use."),
88
):
99
"""Check the daily problem."""
1010
from .show import show
1111

12+
if editor not in ['code', 'vim', 'nano']:
13+
typer.echo(typer.style(f"❌ Unsupported editor: {editor}", fg=typer.colors.RED))
14+
raise typer.Exit(1)
15+
1216
result = get_daily_question()
1317
question = result['data']['activeDailyCodingChallengeQuestion']
1418

src/commands/edit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
def edit(
1010
problem: str = typer.Argument(..., help="Problem name or id."),
1111
lang: str = typer.Argument("cpp", help="Programming language to use."),
12-
editor: str = typer.Option("code", '-e', help="Code editor to use."),
12+
editor: str = typer.Option("code", '-e', '--editor', help="Code editor to use."),
1313
):
1414
"""Solves a problem by passing lang param and open it with your code editor."""
1515
question_data = solution_manager.get_question_data(problem).get('data', {}).get('question')

src/server/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def fetch_problem_list(
137137
skip: int = 0,
138138
filters: dict = {}
139139
):
140-
if filters and 'difficulty' in filters:
140+
if filters and 'difficulty' in filters and filters['difficulty']:
141141
filters['difficulty'] = filters['difficulty'].upper()
142142

143143
client = create_leetcode_client(csrf_token, session_id)

0 commit comments

Comments
 (0)