leetcode-cli

command module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 6 Imported by: 0

README

LeetCode CLI Tool

This Go-based CLI tool fetches LeetCode problems listed in a README.md file and saves their details locally. It leverages the LeetCode API to retrieve problem information and stores it in a structured format.

Features

  • Parses a README.md file to extract problem slugs.
  • Fetches problem details from the LeetCode API.
  • Saves problem details in a local directory structure.
  • Skips problems that are marked as "paid only".

Installation

  1. Install the tool using go install:
go install github.com/Baticaly/leetcode-cli@latest
  1. Ensure your GOPATH/bin is in your PATH environment variable. You can add the following line to your shell profile (~/.bashrc, ~/.zshrc, etc.):
export PATH=$PATH:$GOPATH/bin

Then, reload your shell profile:

source ~/.bashrc

Usage

  1. Ensure your README.md file is formatted correctly with problem slugs. Example:
## LeetCode Archive

- [x] 1.Two Sum
- [ ] 2.Add Two Numbers
- [ ] 3.Longest Substring Without Repeating Characters
- [x] 4.Median of Two Sorted Arrays
  1. Run the CLI tool:
leetcode-cli <README.md>
  1. The tool will fetch the specified problems and save their details in the problems directory.

Example

Given the following README.md:

## LeetCode Archive

- [x] 1.Two Sum
- [ ] 2.Add Two Numbers
- [ ] 3.Longest Substring Without Repeating Characters
- [x] 4.Median of Two Sorted Arrays

The tool will fetch details for "Add Two Numbers" and "Longest Substring Without Repeating Characters" and save them in the problems directory.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL