Skip to content

Commit

Permalink
Remove trailing whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Antosser committed Aug 25, 2024
1 parent e02dfde commit 2f22fb8
Show file tree
Hide file tree
Showing 4 changed files with 375 additions and 7 deletions.
156 changes: 156 additions & 0 deletions README.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<h1
id="cargo-leet---a-leetcode-local-development-assistant"><code>cargo-leet</code>
- A leetcode local development assistant</h1>
<p>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.</p>
<h2 id="usage">Usage</h2>
<p>The <code>cargo leet</code> program helps you streamline your
workflow with LeetCode problems by generating local files for solution
development and testing before submitting them back to LeetCode. Below
is a summary of how to use the various commands and options available in
<code>cargo leet</code>.</p>
<h3 id="general-usage">General Usage</h3>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> leet <span class="pp">[</span><span class="ss">OPTIONS</span><span class="pp">]</span> <span class="op">&lt;</span>COMMAND<span class="op">&gt;</span></span></code></pre></div>
<h3 id="commands">Commands</h3>
<ul>
<li><p><strong>new</strong><br />
Creates a new pre-configured project based on a template, which can be
used with <code>cargo-leet</code>.</p>
<div class="sourceCode" id="cb2"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> leet new <span class="pp">[</span><span class="ss">OPTIONS</span><span class="pp">]</span> <span class="pp">[</span><span class="ss">NAME</span><span class="pp">]</span></span></code></pre></div></li>
<li><p><strong>generate, -g, gen</strong><br />
Generates a module for the specified problem, allowing you to start
working on the solution locally. You can provide a LeetCode problem slug
or URL, or leave it blank to use the daily challenge.</p>
<div class="sourceCode" id="cb3"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> leet generate <span class="pp">[</span><span class="ss">OPTIONS</span><span class="pp">]</span> <span class="pp">[</span><span class="ss">PROBLEM</span><span class="pp">]</span></span></code></pre></div></li>
<li><p><strong>active</strong><br />
Prints the currently active problem or sets the active problem to the
provided problem slug.</p>
<div class="sourceCode" id="cb4"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> leet active <span class="pp">[</span><span class="ss">OPTIONS</span><span class="pp">]</span> <span class="pp">[</span><span class="ss">PROBLEM_SLUG</span><span class="pp">]</span></span></code></pre></div></li>
<li><p><strong>test</strong><br />
Runs tests on the currently active problem to verify your solution.</p>
<div class="sourceCode" id="cb5"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> leet test <span class="pp">[</span><span class="ss">OPTIONS</span><span class="pp">]</span></span></code></pre></div></li>
</ul>
<h3 id="options">Options</h3>
<ul>
<li><strong>-p, –path &lt;FOLDER&gt;</strong><br />
Specify the path to the project root. If not provided, the current
working directory is used.</li>
<li><strong>-l, –log-level &lt;LOG_LEVEL&gt;</strong><br />
Set the logging level. Default is <code>warn</code>. Available levels:
<ul>
<li><code>off</code>: No logging</li>
<li><code>error</code></li>
<li><code>warn</code></li>
<li><code>info</code></li>
<li><code>debug</code></li>
<li><code>trace</code></li>
</ul></li>
<li><strong>-h, –help</strong><br />
Displays help information.</li>
<li><strong>-V, –version</strong><br />
Prints the version of <code>cargo leet</code>.</li>
</ul>
<h3 id="examples">Examples</h3>
<ul>
<li><p><strong>Create a new project</strong>:</p>
<div class="sourceCode" id="cb6"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> leet new my-leetcode-project</span></code></pre></div></li>
<li><p><strong>Change into the directory</strong></p>
<div class="sourceCode" id="cb7"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> my-leetcode-project</span></code></pre></div></li>
<li><p><strong>Generate a module for a specific problem</strong>:</p>
<div class="sourceCode" id="cb8"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> leet generate two-sum</span></code></pre></div></li>
<li><p><strong>Set the active problem (done automatically by
<code>cargo leet gen</code>)</strong>:</p>
<div class="sourceCode" id="cb9"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> leet active two-sum</span></code></pre></div></li>
<li><p><strong>Run tests on the active problem</strong>:</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> leet test</span></code></pre></div></li>
</ul>
<h2 id="installation">Installation</h2>
<p>Note: If <code>cargo-leet</code> 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).</p>
<h3 id="build-from-source">Build from Source</h3>
<p>You can build <code>cargo-leet</code> from source using two different
channels:</p>
<ul>
<li><p><strong>Stable (main)</strong></p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> install <span class="at">--git</span> https://github.com/rust-practice/cargo-leet.git <span class="at">--branch</span> main <span class="at">-F</span> tool</span></code></pre></div>
<p>This installs the stable version of <code>cargo-leet</code> from the
<code>main</code> branch.</p></li>
<li><p><strong>Development (develop)</strong></p>
<div class="sourceCode" id="cb12"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> install <span class="at">--git</span> https://github.com/rust-practice/cargo-leet.git <span class="at">--branch</span> develop <span class="at">-F</span> tool</span></code></pre></div>
<p>This installs the latest development version from the
<code>develop</code> branch, which may include new features or changes
that are still being tested.</p></li>
</ul>
<h3 id="install-from-crates.io">Install from crates.io</h3>
<p>You can also install <code>cargo-leet</code> directly from crates.io.
However, please note that the crates.io release may not always reflect
the latest updates.</p>
<div class="sourceCode" id="cb13"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> install cargo-leet <span class="at">-F</span> tool</span></code></pre></div>
<h3
id="running-directly-from-source-without-installation-for-development">Running
Directly from Source without Installation (For Development)</h3>
<p>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
<code>cargo-leet</code>.</p>
<h4 id="running-in-the-current-directory">Running in the Current
Directory</h4>
<p>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
<code>--path</code> option.</p>
<p>For example, to run the tool against a specific test repository:</p>
<div class="sourceCode" id="cb14"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> run <span class="at">-F</span> tool <span class="at">--</span> leet gen <span class="at">--path</span> <span class="va">$TEST_REPO</span></span></code></pre></div>
<h4 id="using-an-alias">Using an Alias</h4>
<p>If you have an alias configured in <code>.cargo/config.toml</code>,
you can simplify the command:</p>
<div class="sourceCode" id="cb15"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> g</span></code></pre></div>
<p>For additional options and usage details, refer to the <a
href="#cargo-leet-generate---help">generate help</a>.</p>
<h2 id="using-as-a-library">Using as a Library</h2>
<p>You can use <code>cargo-leet</code> as a library to mimic the
LeetCode environment in your own projects. To do so, add it as a
dependency in your <code>Cargo.toml</code> file using</p>
<div class="sourceCode" id="cb16"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cargo</span> add cargo-leet</span></code></pre></div>
<p>For more information, see <a href="https://docs.rs/cargo-leet/">the
documentation</a>.</p>
<h2 id="license">License</h2>
<p>All code in this repository is dual-licensed under either:</p>
<ul>
<li>Apache License, Version 2.0 (<a
href="LICENSE-APACHE">LICENSE-APACHE</a> or
http://apache.org/licenses/LICENSE-2.0)</li>
<li>MIT license (<a href="LICENSE-MIT">LICENSE-MIT</a> or
http://opensource.org/licenses/MIT)</li>
</ul>
<p>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 <a href="https://github.com/bevyengine/bevy/issues/2373">issue</a>
on <a href="https://bevyengine.org">Bevy</a>’s repo.</p>
<h3 id="contribution">Contribution</h3>
<p>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.</p>
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ cargo leet [OPTIONS] <COMMAND>

### Commands

- **new**
- **new**
Creates a new pre-configured project based on a template, which can be used with `cargo-leet`.

```sh
cargo leet new [OPTIONS] [NAME]
```

- **generate, -g, gen**
- **generate, -g, gen**
Generates a module for the specified problem, allowing you to start working on the solution locally. You can provide a LeetCode problem slug or URL, or leave it blank to use the daily challenge.

```sh
cargo leet generate [OPTIONS] [PROBLEM]
```

- **active**
- **active**
Prints the currently active problem or sets the active problem to the provided problem slug.

```sh
cargo leet active [OPTIONS] [PROBLEM_SLUG]
```

- **test**
- **test**
Runs tests on the currently active problem to verify your solution.

```sh
Expand All @@ -45,7 +45,7 @@ cargo leet [OPTIONS] <COMMAND>

### Options

- **-p, --path \<FOLDER\>**
- **-p, --path \<FOLDER\>**
Specify the path to the project root. If not provided, the current working directory is used.
- **-l, --log-level \<LOG_LEVEL\>**
Set the logging level. Default is `warn`. Available levels:
Expand All @@ -55,9 +55,9 @@ cargo leet [OPTIONS] <COMMAND>
- `info`
- `debug`
- `trace`
- **-h, --help**
- **-h, --help**
Displays help information.
- **-V, --version**
- **-V, --version**
Prints the version of `cargo leet`.

### Examples
Expand Down
Binary file added README.pdf
Binary file not shown.
Loading

0 comments on commit 2f22fb8

Please sign in to comment.