#leetcode #local #problem #cargo #assistant #locally #tool

bin+lib cargo-leet

Utility program to help with working on leetcode locally

1 unstable release

0.2.0 Feb 1, 2024

#2201 in Development tools

MIT/Apache

120KB
1.5K SLoC

cargo-leet - A leetcode local development assistant

A program that given the link or slug to a leetcode problem, creates a local file where you can develop and test your solution before post it back to leetcode.

ScreenShots

cargo leet

ScreenShot

cargo leet generate --help

ScreenShot

Using Library Support

Using the library to "mimic" leetcode environment. Add library as a dependency as below. Then add use statements as necessary. The use statements are automatically added if tool is used to generate the file for the problem.

cargo-leet = { git = "https://github.com/rust-practice/cargo-leet.git", branch = "develop" }

Tool Installation

NB: If cargo-leet is already installed you do the install it will just replace it even it it was previously installed from a different source. For example if you install it from a clone then run the command to install from git it will replace the existing version that is installed (they will not both be installed).

From GitHub

cargo install --git https://github.com/rust-practice/cargo-leet.git --branch main --features=tool

From Clone

After cloning the repo run

cargo install --path . --features=tool

or using alias from .cargo/config.toml

cargo i

Running Directly from source without install (When developing the tool)

These commands allow you to run the tool directly from the source code without installation. By default they will run the tool on the current working directory. This means that it will run in the current project folder for cargo-leet. This may be fine for testing but if you want to be able to actually run the code, it might be more appropriate to pass the path parameter and specify the path to the repository you want to to run against. Eg. cargo g --path $TEST_REPO For more options see generate help

cargo run --features=tool -- leet gen

or using alias from .cargo/config.toml

cargo g

Tool Uninstallation

cargo uninstall cargo-leet

License

All code in this repository is dual-licensed under either:

at your option. This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both as noted in this issue on Bevy's repo.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.3–2.3MB
~42K SLoC