Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change lf feature and update docs #27

Merged
merged 16 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ resources/stores/*
# cli-dist
pl-cli
*/colorFont.js
pl-build

# package manager
yarn.lock
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Then, `leetcode-practice` is all you need!
### 0. Prerequisites

| Tool | Remarks |
|----------|:-----------------------------------------------:|
| -------- | :---------------------------------------------: |
| nodejs | lts |
| git | lts |
| computer | Ability to run Chrome and a code editor |
Expand Down Expand Up @@ -230,15 +230,15 @@ npm i --save-dev leetcode-practice
`KFC` is a simple mnemonic that can quickly remember our three core commands: `lk`, `lf`, and `lc`.

| Command | Explanation |
|---------|-----------------------------------------------------------------------------------------------------------------------------------|
| ------- | --------------------------------------------------------------------------------------------------------------------------------- |
| lc | Core creation command, supports three creation modes (daily question, specified question, random question) for creating questions |
| lk | Core checking command, supports three modes corresponding to the question for checking questions |
| lf | Core search command, which can quickly search for the question you want based on prompts |

#### [1]. lc

| Short Parameter | Full Parameter | Explanation |
|------------------------|----------------|-------------------------------------------------------------------------|
| ---------------------- | -------------- | ----------------------------------------------------------------------- |
| No parameter / `-t` | `--today` | Create today's daily question |
| Question number / `-i` | `--identity` | Create the question corresponding to the specified number |
| `-r` | `--random` | Create a random question that has not appeared in the current directory |
Expand All @@ -247,7 +247,7 @@ npm i --save-dev leetcode-practice
#### [2]. lk

| Short Parameter | Full Parameter | Explanation |
|------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| ---------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| No parameter / `-t` | `--today` | Check today's daily question |
| Question number / `-i` | `--identity` | Check the question corresponding to the specified number, and check if the question with the specified ID exists in the current working directory |
| `-r` | `--random` | Check the question created using the random mode last time |
Expand All @@ -259,13 +259,13 @@ npm i --save-dev leetcode-practice
#### [3]. lf

| Short Parameter | Full Parameter | Explanation |
|-----------------|----------------|---------------------------------------------------------------------------|
| --------------- | -------------- | ------------------------------------------------------------------------- |
| No parameter | None | Enter interactive search, and search or filter questions based on prompts |

#### [4]. General Parameters

| Short Parameter | Full Parameter | Explanation |
|------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ---------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-d <directory>` | `--directory <directory>` | Specify the working directory (a relative address of the current execution directory), which will affect the creation and checking |
| `-V` | `--version` | Check the version number |
| `-h` | `--help` | Get help information |
Expand Down
74 changes: 39 additions & 35 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

### 0. 预备条件

| 工具 | 备注 |
|----------|:----------------:|
| nodejs | lts |
| git | lts |
| 工具 | 备注 |
| -------- | :------------------------: |
| nodejs | lts |
| git | lts |
| computer | 能够运行chrome和代码编辑器 |
| patience | 一颗能够坚持刷题的心 |

Expand All @@ -36,7 +36,9 @@
> git:[git下载地址](https://git-scm.com/downloads)

### 1. 我可以怎么用? (三种方案供你选择)

#### 方案A.脚手架 CLI (推荐)

此方案是最为推荐的使用方案,通过脚手架指令`lc`、`lk`、`lf`自由灵活的在任意的目录中创建并检查你的题解。

> 使用预览
Expand All @@ -45,7 +47,7 @@

如果你想要快速的创建一个自己的题解库,可以使用我们的模板项目进行快速的创建github项目,并且获得完善的初始化内容。

> 使用预览
> 使用预览

#### 方案C.插件 Plugin (支持,待开发)

Expand All @@ -54,11 +56,12 @@
> 使用预览

### 2. 我应该怎么用?(三种方案的详细的安装和使用教程)

#### 方案A.脚手架 CLI

##### 1.安装

你可以使用任意一款npm包管理软件(例如*`*npm*`*,*`*yarn*`*,*`*pnpm*`*等)的在`项目`中或者`全局`进行安装。
你可以使用任意一款npm包管理软件(例如`npm`,`yarn`,`pnpm`等)的在`项目`中或者`全局`进行安装。

```shell
# 示例:全局安装
Expand Down Expand Up @@ -179,7 +182,7 @@ MODE: identity

e.g. 以我个人的项目为例

```shell
```shell
# 这里只是示例,请拉取自己的项目(在你看到这进行尝试的时候,此项目可能已经被清理,正常现象请勿疑惑)
git clone git@github.com:wh131462/my-leetcode-practice.git
# 移动进项目目录
Expand All @@ -200,15 +203,16 @@ yarn lc
```

你也可以使用指令`lc`来创建,当然,你只能在项目中使用我们的脚本(如果你没有全局安装`leetcode-practice`的话)。

```shell
# 使用lc 会在当前工作目录创建 如果 需要和脚本的表现保持一致(指在src目录下创建),请使用 -d src 参数
lc
```

> 注意:在这里进行一下强调,项目内指令的说法是指指令的作用范围限制是当前的项目目录,也就是说在其他的目录,你尝试使用lc指令会发现不起作用。
>
>
> 同样的,你也会发现在第一次安装好的时候,在项目内使用lc指令,也是不起作用的,这个时候需要关闭终端(terminal)再打开进行手动的刷新缓存。
>
>
> npm脚本指在 package.json 中的 scripts 字段下封装的脚本指令。

###### 3. 更新依赖
Expand All @@ -230,48 +234,48 @@ npm i --save-dev leetcode-practice

`KFC`是一个简便记法,可以快速记忆我们的三个核心指令:`lk`,`lf`,`lc`。

| 指令 | 说明 |
|----|--------------------------------------------------------|
| lc | 核心创建指令,支持三种创建模式 ( 每日一题、指定题目、随机题目 ) 进行题目的创建 |
| lk | 核心检查指令,支持三种模式对应的题目检测 |
| lf | 核心查找指令,可以快捷的搜索你想要的题目,支持Hot100,关键词搜索,条件筛选等模式进行搜索题目并支持创建 |
| 指令 | 说明 |
| ---- | ------------------------------------------------------------------------------------------------------ |
| lc | 核心创建指令,支持三种创建模式 ( 每日一题、指定题目、随机题目 ) 进行题目的创建 |
| lk | 核心检查指令,支持三种模式对应的题目检测 |
| lf | 核心查找指令,可以快捷的搜索你想要的题目,支持Hot100,关键词搜索,条件筛选等模式进行搜索题目并支持创建 |

#### [1].lc

| 简单参数 | 完整参数 | 说明 |
|-----------|--------------|------------------|
| 无参数/`-t` | `--today` | 创建今日的每日一题 |
| 题目编号/`-i` | `--identity` | 创建指定编号对应的题目 |
| `-r` | `--random` | 创建当前目录下未出现过的随机题目 |
| `-e` | `--easy` | 交互式创建题目 |
| 简单参数 | 完整参数 | 说明 |
| ------------- | ------------ | -------------------------------- |
| 无参数/`-t` | `--today` | 创建今日的每日一题 |
| 题目编号/`-i` | `--identity` | 创建指定编号对应的题目 |
| `-r` | `--random` | 创建当前目录下未出现过的随机题目 |
| `-e` | `--easy` | 交互式创建题目 |

#### [2].lk

| 简单参数 | 完整参数 | 说明 |
|-----------|--------------|--------------------------------------|
| 无参数/`-t` | `--today` | 检查今日的每日一题 |
| 简单参数 | 完整参数 | 说明 |
| ------------- | ------------ | ---------------------------------------------------------------------- |
| 无参数/`-t` | `--today` | 检查今日的每日一题 |
| 题目编号/`-i` | `--identity` | 检查指定编号对应的题目,会检查当前工作目录下的是否存在指定id对应的题目 |
| `-r` | `--random` | 检查上一次使用随机模式创建的题目 |
| `-e` | `--easy` | 交互式的根据提示去检查对应的题目 |
| `-r` | `--random` | 检查上一次使用随机模式创建的题目 |
| `-e` | `--easy` | 交互式的根据提示去检查对应的题目 |

> 注意: 当你检测的时候需要注意,使用什么模式去检查,请确保你已经执行过对应模式的创建操作。
> 指定编号模式除外,因为会优先检查指定的id是否在当前工作目录存在。

#### [3].lf

| 简单参数 | 完整参数 | 说明 |
|------|------|---------------------------|
| 无参数 | 无 | 进入交互式查询,可根据提示搜索或筛选题目并创建题目 |
| 简单参数 | 完整参数 | 说明 |
| -------- | -------- | -------------------------------------------------- |
| 无参数 | 无 | 进入交互式查询,可根据提示搜索或筛选题目并创建题目 |

#### [4].通用参数

| 简单参数 | 完整参数 | 说明 |
|------------------|---------------------------|---------------------------------------------------------------------------|
| `-d <directory>` | `--directory <directory>` | 指定工作目录(是一个当前执行目录的相对地址),会影响创建和检查 |
| `-V` | `--version` | 检查版本号 |
| `-h` | `--help` | 获取帮助信息 |
| 简单参数 | 完整参数 | 说明 |
| ---------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `-d <directory>` | `--directory <directory>` | 指定工作目录(是一个当前执行目录的相对地址),会影响创建和检查 |
| `-V` | `--version` | 检查版本号 |
| `-h` | `--help` | 获取帮助信息 |
| `-l [language]` | `--language [language]` | 不指定参数为获取当前的语言环境(默认为javascript),指定参数可以设置语言环境为对应语言(如`-l java`可以指定语言环境为java) |
| `-u` | `--update` | 更新当前脚本或者依赖 |
| `-u` | `--update` | 更新当前脚本或者依赖 |

> 注意:通用参数指三个脚本`lk`,`lf`,`lc`都支持的参数,使用上的语义一般来说是相同的,但是可能有些指令上的行为含义会有所不同(比如`lc`指令指定`-d`参数是指`在指定目录中创建题目`,而`lk`指令指定`-d`参数就是指`在指定目录创建题目`)。

Expand All @@ -293,4 +297,4 @@ npm i --save-dev leetcode-practice

### 3.Star趋势图

[![Star History Chart](https://api.star-history.com/svg?repos=EternalHeartTeam/leetcode-practice&type=Date)](https://star-history.com/#EternalHeartTeam/leetcode-practice&Date)
[![Star History Chart](https://api.star-history.com/svg?repos=EternalHeartTeam/leetcode-practice&type=Date)](https://star-history.com/#EternalHeartTeam/leetcode-practice&Date)
Loading
Loading