Skip to content

Commit

Permalink
docs: update configuration readme
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Jan 6, 2024
1 parent 0fe9195 commit 37ce6c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ leetgo test last/ # `last/` means all questions of the last generated

## Configuration

Leetgo uses two levels of configuration files, the global configuration file located at `~/.config/leetgo/config.yaml` and the local configuration file located at `leetgo.yaml` in the project root.
> [!WARNING]
> Since `v1.4`, `leetgo` no longer reads the global `~/.config/leetgo/config.yaml` file, please put all configurations in the project's `leetgo.yaml` file.
These configuration files are created during the `leetgo init` process.
The local configuration file in the project overrides the global configuration.
`leetgo init` generates a `leetgo.yaml` file in the current directory, which contains all the configurations of `leetgo`. You can modify this file according to your needs.

It is generally recommended to use the global configuration as the default configuration and customize it in the project by modifying the `leetgo.yaml` file.
The directory where `leetgo.yaml` is located is considered as the root directory of a `leetgo` project, and `leetgo` will generate all code files undeer this directory. `leetgo` will look for the `leetgo.yaml` file in the current directory. If it is not found, it will recursively search upwards until a `leetgo.yaml` file is found or the root directory of the file system is reached.

Here is the demonstration of complete configurations:
Below is the demonstration of a complete configuration:

<details>
<summary>Click to expand</summary>
Expand Down Expand Up @@ -266,7 +266,7 @@ editor:
<!-- END CONFIG -->
</details>
## LeetCode Support
## LeetCode Credentials
`leetgo` uses LeetCode's GraphQL API to retrieve questions and submit solutions. `leetgo` needs your LeetCode cookies to access the authenticated API.

Expand Down
9 changes: 5 additions & 4 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ leetgo test last/ # last/ 表示最近生成的比赛的所有题目

## 配置说明

`leetgo` 使用两级配置结构:全局配置和项目配置。
> [!WARNING]
> `v1.4` 开始,`leetgo` 不再读取全局的 `~/.config/leetgo/config.yaml` 文件,请将所有配置都放到项目的 `leetgo.yaml` 文件中。
全局配置位于 `~/.config/leetgo/config.yaml`,项目配置是项目根目录中的 `leetgo.yaml` 文件。 他们都是在 `leetgo init` 初始化过程中生成的
`leetgo init` 会在当前目录生成一个 `leetgo.yaml` 文件,这个文件包含了 `leetgo` 的所有配置,你可以根据自己的需要修改这个文件

项目配置会覆盖全局配置中的相同配置。通常使用全局配置作为默认的配置,然后在各个项目中调整 `leetgo.yaml` 来自定义项目中的配置
`leetgo.yaml` 所在的目录会被认为是一个 `leetgo` 项目的根目录,`leetgo` 会在这个目录下生成所有的代码文件。`leetgo` 会在当前目录中查找 `leetgo.yaml` 文件,如果没有找到,会向上递归查找,直到找到一个 `leetgo.yaml` 文件或者到达文件系统的根目录

下面是一个完整配置的展示:

Expand Down Expand Up @@ -258,7 +259,7 @@ editor:
```
<!-- END CONFIG -->
## LeetCode 支持情况
## LeetCode 认证
`leetgo` 使用 LeetCode 的 GraphQL API 来获取题目和提交代码,`leetgo` 需要 LeetCode 的 Cookie 来代替你做这些事情。

Expand Down

0 comments on commit 37ce6c7

Please sign in to comment.