rust-practice / cargo-leet

Program to make working on leetcode problems locally more convenient
Apache License 2.0
5 stars 3 forks source link

cargo-leet - A leetcode local development assistant

The cargo leet program helps you streamline your workflow with LeetCode problem local file where you can develop and test your solution before post it back to leetcode.

Usage

Below is a summary of how to use the various commands and options available in cargo leet.

General Usage

cargo leet [OPTIONS] <COMMAND>

Commands

Options

Examples

Installation

Note: If cargo-leet is already installed and you install it again, the existing installation will be replaced, even if it was originally installed from a different source. For instance, if you first install it from a local clone and then reinstall it from a Git repository, the new installation will overwrite the previous one (you won't have both versions installed).

Build from Source

You can build cargo-leet from source using two different channels:

Install from crates.io

You can also install cargo-leet directly from crates.io. However, please note that the crates.io release may not always reflect the latest updates.

cargo install cargo-leet -F tool

Running Directly from Source without Installation (For Development)

When developing the tool, you can run it directly from the source code without needing to install it. By default, these commands will execute the tool within the current working directory, meaning it will interact with the current project folder for cargo-leet.

Running in the Current Directory

Running the tool this way is useful for testing but may not be ideal if you need to target a specific project or repository. In such cases, you can specify the path to the desired repository using the --path option.

For example, to run the tool against a specific test repository:

cargo run -F tool -- leet gen --path $TEST_REPO

Using an Alias

If you have an alias configured in .cargo/config.toml, you can simplify the command:

cargo g

For additional options and usage details, refer to the generate help in commands.

Using as a Library

You can use cargo-leet as a library to mimic the LeetCode environment in your own projects. To do so, add it as a dependency in your Cargo.toml file using

cargo add cargo-leet

For more information, see the documentation.

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.