leetup
Leetcode cli
Install
- MacOS:
|
- Linux:
|
- Cargo:
- Windows:
Download from. Extract the zipped x86_64 windows target file.
Note: You will need to add
leetup.exe
to PATH to access from Command Prompt.
Usage:
Inject code fragments:
You can inject pieces of code that you frequently use in certain positions of the generated code file. Example: Standard library imports for each language can be put into a config. Leetup
will pick it up and insert into the generated file.
Config:
Create ~/.leetup/config.json
and customize according to your preference:
Generated code looks something like this in Rust:
// @leetup=custom
// @leetup=info id=1 lang=rust slug=two-sum
/*
* [SNIP]
*/
// @leetup=custom
// @leetup=inject:before_code_ex
// Test comment
// Test code
// @leetup=inject:before_code_ex
// @leetup=code
// @leetup=inject:before_code
use RefCell;
use ;
use Rc;
// @leetup=inject:before_code
// @leetup=code
// @leetup=inject:after_code
// This is helpful when you want to run this program locally
// and avoid writing this boilerplate code for each problem.
;
// @leetup=inject:after_code
During testing and submitting to Leetcode, only the chunk of code between @leetup=code
will be submitted:
// @leetup=inject:before_code
use RefCell;
use ;
use Rc;
// @leetup=inject:before_code
Others are ignored!
Credit:
This project is inspired by: https://github.com/leetcode-tools/leetcode-cli