Leetcode-Fetcher Commands ⌨️
This documentation page aims to illustrate each command group and, for each of them, what’s is about.
1. Command groups
As already being said, running the help
shows all possible commands (with optional or required parameters) that can be submitted to the application. As you might notice, each batch of commands is separated by a title. This string represents the name of the group to which the entire batch belongs to. That is, commands are divided into groups: Generic, Problems, User, Submissions and State.
The following table shows all possible commands for each existing group.
Name | Syntax | Description |
---|---|---|
Generic | ||
Help | help [cmd1 cmd2 ...] | Shows the helper message for each given command. If no command is provided, consider all. |
Clear | clear | Clears the screen content |
Quit | quit | Quits the application |
Problems | ||
List | list | Locally fetches a number of problems from leetcode. The search is filtered using the variables set with `set` or `unset` |
Fetch | fetch <NAME|ID> <value> | Fetch locally a single problem from remote. The problem is specified either using the title-slug or the remote ID. |
Detail | detail <id/idx> [BYID|BYIDX] | Print details about a specified problem. A problem is specified either by local indexing, or remote question IDs. |
Create | create <idx> | Create a problem instance in the provided target folder (which is a variable). The problem is specified only by the local index which means that must already exists locally. |
Daily | daily [create] | Fetch the current daily question and optionally create an instance |
User | ||
Login | login | Open a browser to perform the login and starts a leetcode session. |
Inspect | inspect [USERNAME] | Inspect a given user profile if it exists, or the current logged one |
Submissions | ||
Watch | watch <question-idx|daily> | Cache the given problem for future tests or submissions. An instance of the given problem is create if it does not exists. |
Test | test | Test the cached problem with leetcode remotely (see `watch`) |
Submit | submit | Submit a solution of the cached problem in leetcode (see `watch`) |
State | ||
Set | set [VAR value ...] | Set the value of the specified variable. To inspect available variables use the `show` command. |
Unset | unset [VAR1 VAR2 ...] | Unset variables bringing back to their default values. |
Show | show [SENSITIVE] | Shows values and informations about the application state and variables. If sensitive is given then also user cookies are shown. |
Save | save FILEPATH | Saves the current state into a json file |
Load | load FILEPATH | Loads the state from a json file |
2. Groups Specification
Generic Commands Group
This first group, called Generic, contains a number of commands that are “generic”, meaning they do not releate either to LeetCode or to the current state of the application. Commands like help
, clear
or quit
belongs to this group. Their name are already quite esplicative, however you could find more in the specific page, here.
Problems Commands Group
This group, called Problems, contains commands releated to LeetCode problems. In particular, they aim to interact with a specific LeetCode endpoint to extract problems information and fetch problems locally. However, they do not releate to LeetCode users or submission informations (these are left to others command groups). Commands like list
, fetch
, detail
, create
and daily
belongs to this group. You can find more about Problems commands here.
User Commands Group
This group, called User, contains commands releated to LeetCode Users. Through commands in this group, a user can login into LeetCode and create a new session or, inspects other users statistics like: total number of submissions per difficulty, last accepted submissions, github profile, linkedin profile, public personal informations and so on. Commands like login
and inspect
belongs to this group. You can find more here.
Submission Commands Group
This group, called Submission, contains commands releated to LeetCode Submissions. Using this commands, you can test your current local solution remotely (through the LeetCode backend), provides new tests and submit a final solution that can be either accepted or not. In all cases, results are returned back to the user. Commands like watch
, test
and submit
belongs to this group. You can find more here.
State Commands Group
The final group is called State since all of its commands interact with the state of the application. You can find more here.