#leetcode #command-line-tool #setting-up #cli #local #projects #problem

app leetr

A CLI tool for setting up local LeetCode projects

4 releases

0.1.3 May 29, 2024
0.1.2 May 29, 2024
0.1.1 May 28, 2024
0.1.0 May 28, 2024

#4 in #leetcode

GPL-3.0 license

155KB
478 lines

Leetr

A CLI tool for setting up local LeetCode projects.

Installation

Using cargo

cargo install leetr

From source

# Clone the repository
git clone https://github.com/pophilpo/leetr

# Navigate into the project directory
cd leetr

# Build the project in release mode
cargo build --release

# Copy the binary to your bin directory (adjust the path if necessary)
sudo cp target/release/leetr /usr/local/bin

Usage

To use leetr, pass the URL of the LeetCode problem or it's title and the language of your choice (python/rust) to the tool.

Arguments

  • -d, --dir Create a directory with custom name for the problem, otherwise uses problem name
  • -l, --lang Programming language used to setup the project [default: rust]
  • -h, --help Print help

This command generates a Python 3 project with the following structure:

  • A two_sum/README.md file describing the problem.
  • A two_sum/main.py file containing the initial problem code
leetr https://leetcode.com/problems/two-sum/description -l python

This command generates a Rust project with custom name and the following structure:

  • A my_project/README.md file describing the problem.
  • A my_project/main.rs file containing the initial problem code
leetr two-sum -l rust -d my_project

Supported languages

  • Rust
  • Python 3
  • Python
  • C++
  • Java
  • C
  • C#
  • JavaScript
  • TypeScript
  • PHP
  • Swift
  • Kotlin
  • Dart
  • Go
  • Ruby
  • Scala
  • Racket
  • Erlang
  • Elixir

Dependencies

~12–26MB
~364K SLoC