Skip to content

Commit 9901742

Browse files
committed
updated instructions
Signed-off-by: dvishal485 <dvishal485@gmail.com>
1 parent c638b6c commit 9901742

File tree

3 files changed

+35
-30
lines changed

3 files changed

+35
-30
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22
name = "leetcode-runner-cli"
3-
version = "0.2.5"
3+
version = "0.2.6"
44
edition = "2021"
55

66
[dependencies]
7-
clap = { version = "4.2.1", features = ["derive"] }
7+
clap = { version = "4.3.1", features = ["derive"] }
88
colored = "2.0.0"
99
eyre = "0.6.8"
1010
open = "4.1.0"
11-
reqwest = { version = "0.11.16", features = ["blocking", "json"] }
12-
serde = { version = "1.0.159", features = ["derive"] }
13-
serde_json = "1.0.95"
11+
reqwest = { version = "0.11.18", features = ["blocking", "json"] }
12+
serde = { version = "1.0.163", features = ["derive"] }
13+
serde_json = "1.0.96"

README.md

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Executes leetcode testcases and submits your solution through CLI interface
44

5+
![Leetcode Runner CLI Banner](cli-banner.png)
6+
57
**Disclaimer :** This is not an official Leetcode tool. I am not affiliated with Leetcode in any way. This tool is not endorsed by leetcode.
68

79
---
@@ -31,19 +33,20 @@ Executes leetcode testcases and submits your solution through CLI interface
3133
cargo install --path .
3234
```
3335

34-
#### Note
36+
#### Platform Specific Instructions
3537

3638
Depending on your platform you may need to install certain tools to be able to compile successfully.
3739

38-
For example: On Ubuntu system, you may need to execute `apt-get install pkg-config openssl-dev -y` to be able to compile the program successfully.
40+
- On Ubuntu system, you may need to execute `apt-get install pkg-config openssl-dev -y` to be able to compile the program successfully.
41+
- Windows user are good to go.
3942

4043
---
4144

4245
## Usage
4346

4447
1. Setup environment variable `LC_COOKIE` with your leetcode session cookie.
4548

46-
You can get your session cookie by logging in to leetcode and inspecting the cookie in your browser's developer tools.
49+
You can get your session cookie by logging in to leetcode and inspecting the cookie from Request headers in your browser's developer tools.
4750
4851
Make sure to put your cookie in double quotes.
4952
@@ -59,25 +62,25 @@ For example: On Ubuntu system, you may need to execute `apt-get install pkg-conf
5962
6063
---
6164
62-
6365
```bash
6466
leetcode-runner-cli [COMMAND] [OPTIONS <option>]
6567
```
6668
6769
### Commands
6870
69-
| Commands | Description | Arguments |
70-
| :----------------- | :-------------------------------------------------- | :------------------------------ |
71-
| `-h, --help` | Prints help information | - |
72-
| `-V, --version` | Prints version information | - |
73-
| `-a, auth` | Authenticate with leetcode | - |
74-
| `-d, daily` | Fetch daily challenge question | - |
75-
| `-q, question` | Question title / url to fetch | <QUESTION_NAME> |
76-
| `-r, run` | Execute file with default testcases | -f <FILE> (optional) |
77-
| `-rt, run-custom` | Execute file with custom testcases | -f <FILE> (optional) <TESTCASE> |
78-
| `-s, submit` | Submit solution to leetcode after passing testcases | -f <FILE> (optional) |
79-
| `-fs, fast-submit` | Submit solution to leetcode | -f <FILE> (optional) |
80-
| `-p, pack` | Pack your solution and question in a directory | -f <FILE> (optional) |
71+
| Commands | Description | Arguments |
72+
| :----------------- | :--------------------------------------------- | :--------------------------- |
73+
| `-h, --help` | Prints help information | - |
74+
| `-V, --version` | Prints version information | - |
75+
| `-a, auth` | Authenticate with leetcode | - |
76+
| `-d, daily` | Fetch daily challenge question | - |
77+
| `-q, question` | Question title / url to fetch | [QUESTION_NAME] (required) |
78+
| `-r, run` | Execute file with default/specified testcases | -f [FILE] -t [TESTCASE_FILE] |
79+
| `-s, submit` | Submit solution after passing testcases | -f [FILE] |
80+
| `-fs, fast-submit` | Submit solution without checking for testcase | -f [FILE] |
81+
| `-p, pack` | Pack your solution and question in a directory | -f [FILE] |
82+
83+
You can always look into a commands usage by passing `--help`.
8184
8285
### File changes
8386
@@ -112,6 +115,8 @@ fn main() {
112115

113116
### Example usage
114117

118+
The file name need not to be specified explicitly with `--file` or `-f` as it is an optional field. [Check out Note below for more information](#note)
119+
115120
- Fetch question [koko-eating-bananas](https://leetcode.com/problems/koko-eating-bananas/)
116121

117122
```bash
@@ -127,33 +132,33 @@ fn main() {
127132
- Run src/main.rs with default testcases for question [koko-eating-bananas](https://leetcode.com/problems/koko-eating-bananas/)
128133

129134
```bash
130-
leetcode-runner-cli -r /src/main.rs
135+
leetcode-runner-cli -r --file /src/main.rs
131136
```
132137

133138
- Run src/main.rs with custom testcase file
134139

135140
```bash
136-
leetcode-runner-cli -rt testcase.txt /src/main.rs
141+
leetcode-runner-cli -r -t testcase.txt --file /src/main.rs
137142
```
138143

139144
- Submit src/main.rs to leetcode
140145

141146
```bash
142-
leetcode-runner-cli -s /src/main.rs
147+
leetcode-runner-cli -s --file /src/main.rs
143148
```
144149

145-
Note : This will first execute the default testcases and then submit the solution to leetcode only if the testcases pass as a preventive measure to avoid submitting wrong solution.
150+
Note : This will first execute the default testcases (or the specified testcases if given) and then submit the solution to leetcode only if the testcases pass as a preventive measure to avoid submitting wrong solution.
146151

147152
- Submit src/main.rs to leetcode without running testcases
148153

149154
```bash
150-
leetcode-runner-cli -fs /src/main.rs
155+
leetcode-runner-cli -fs -f /src/main.rs
151156
```
152157

153158
- Pack your code and question into a directory to maintain your progress or upload on Git
154-
159+
155160
```bash
156-
leetcode-runner-cli -p /src/main.rs
161+
leetcode-runner-cli -p --file /src/main.rs
157162
```
158163

159164
#### Note
@@ -164,7 +169,7 @@ fn main() {
164169
165170
So, in the above examples, you can simply do `cd ./src` and then run the following commands :
166171
167-
- Execute with custom testcases : `leetcode-runner-cli -rt ./testcase.txt`
172+
- Execute with custom testcases : `leetcode-runner-cli -r -t testcase.txt`
168173
- Execute with default testcases : `leetcode-runner-cli -r`
169174
- Submit : `leetcode-runner-cli -s`
170175
- Submit without running testcases : `leetcode-runner-cli -fs`
@@ -188,4 +193,4 @@ More languages can be added manually as per requirement by [changing enum](https
188193
- This Project is [Apache-2.0](./LICENSE) Licensed
189194
- Copyright 2023 [Vishal Das](https://github.com/dvishal485)
190195
191-
--
196+
---

cli-banner.png

173 KB
Loading

0 commit comments

Comments
 (0)