-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
481 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: About PSCompletions(psc) command | ||
next: | ||
text: About PR (Pull Request) | ||
link: '../contribute/index.md' | ||
--- | ||
|
||
- Waiting... | ||
- You can trigger completion by running `psc`, then learn about them by completion tip. | ||
- View the README file of PSCompletions. | ||
- Enter 'psc' and press 'Enter' to print some module information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
--- | ||
title: About the structure of json file | ||
next: | ||
text: About PR (Pull Request) | ||
link: '../contribute/index.md' | ||
--- | ||
|
||
# About the structure of json file | ||
|
||
```json | ||
{ | ||
"root": [], | ||
"options": [], | ||
"common_options": [], | ||
"info": {}, | ||
"config": [] | ||
} | ||
``` | ||
|
||
- The json file uses a schema structure to ensure that the json content is correct and complete. | ||
- You can learn about these properties by hovering over the prompts | ||
- In fact, it is very simple, you can refer to the existing json file. | ||
|
||
## Properties | ||
|
||
### 1. `root` | ||
|
||
- The type of value: array | ||
- The most core attribute (usually) | ||
|
||
- Each item in the array is an object | ||
- Object available attribute: `name`(required)、`alias`、`symbol`、`next`、`options`、`tip` | ||
- In vscode, with schema, it's easy to understand. | ||
- The values of `next` and `options` are also arrays, almost identical to `root`. | ||
- Difference: The `options` attribute is not allowed in `options`. | ||
- In most cases, you don't need to think about defining `symbol` because `symbol` will automatically add some value to the symbols depending on context | ||
- When the completion item has `next`, `SpaceTab` is automatically added. | ||
- The `symbol` attribute in `options` automatically adds the `OptionTab`. | ||
- Some Cases where `Symbol` needs to be added manually. | ||
|
||
- When several preset values are needed in `options` | ||
|
||
- ```json | ||
{ | ||
"name": "reset", | ||
"options": [ | ||
{ | ||
"name": "--soft", | ||
"symbol": ["WriteSpaceTab", "SpaceTab"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
- When completion uses `hooks` to add some dynamic completion items. | ||
- ```json | ||
{ | ||
"name": "rm", | ||
"symbol": "SpaceTab" | ||
} | ||
``` | ||
|
||
### 2. `options` | ||
|
||
- The type of value: array | ||
- Same as the `options` for each item in `root`. | ||
- ```json | ||
{ | ||
"options": [ | ||
{ | ||
"name": "--version", | ||
"alias": ["-v"], | ||
"tip": "Show current version" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### 3. `common_options` | ||
|
||
- The type of value: array | ||
- All options are displayed at all times. | ||
- ```json | ||
{ | ||
"options": [ | ||
{ | ||
"name": "--help", | ||
"alias": ["-h"], | ||
"tip": "Show help." | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### 4. `info` | ||
|
||
- The type of value: object | ||
- All values defined can be obtained elsewhere with the following syntax. | ||
- ```json | ||
// {{ $info.xxx }} | ||
// {{ $json.xxx }} $json is the object of the entire json file. | ||
{ | ||
"root": [ | ||
{ | ||
"name": "test", | ||
"tip": "{{ $info.test_tip }}" | ||
}, | ||
{ | ||
"name": "abc", | ||
"tip": "{{ $json.info.abc_tip }}" | ||
} | ||
], | ||
"info": { | ||
"test_tip": "this is test content.", | ||
"abc_tip": "abcdefg" | ||
} | ||
} | ||
``` | ||
|
||
### 5. `config` | ||
|
||
- The type of value: array | ||
- Define some special configurations for completion.(e.g. `git`) | ||
- ```json | ||
"config": [ | ||
{ | ||
"name": "disable_hooks", | ||
"value": 0, | ||
"values": [ | ||
1, | ||
0 | ||
], | ||
"tip": [ | ||
"Set whether to disable hooks. Default to 0.\n", | ||
"Hooks in git are mainly used to parse commit information, branch information, etc., and then dynamically add them to some completions (such as reset,checkout,branch, etc.)\n", | ||
"For example, enter <@Magenta>git reset<@Blue>, press <@Magenta>Space<@Blue> and <@Magenta>Tab<@Blue>, and you can get the resolved commit completions.\n", | ||
"If you don't need it, you can disable it, which will improve the loading speed of the completion.\n", | ||
"If you disable it, the <@Magenta>max_commit<@Blue> configuration will also be invalid." | ||
] | ||
}, | ||
{ | ||
"name": "max_commit", | ||
"value": 20, | ||
"values": [ | ||
-1, | ||
20 | ||
], | ||
"tip": [ | ||
"The maximum number that can be parsed for a project commit.\n", | ||
"If it is <@Magenta>-1<@Blue>, all commits will be parsed.\n", | ||
"If there are a large number of project commits, setting <@Magenta>-1<@Blue> will affect the loading speed of the completion." | ||
] | ||
} | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: About PR (Pull Request) | ||
prev: | ||
text: About the structure of json file | ||
link: '../completion/index.md' | ||
--- | ||
|
||
# About PR (Pull Request) | ||
|
||
1. Prerequisite: You should read [About the structure of completion json file](../completion/index.md) first. | ||
2. You should fork [PSCompletions](https://github.com/abgox/PSCompletions), and clone to your machine. | ||
3. After Changing, you should commit and create the `PR`. | ||
|
||
## 1. Update the content of completion json file | ||
|
||
- Patch some tips of the completion.(`tip` attributes) | ||
- Add some missing commands for the completion. | ||
|
||
## 2. Add language | ||
|
||
1. In the `completions` directory, select the language you want to add. | ||
2. Add the language identifier to the language in the `config.json` file. | ||
3. Add a json file with the same name as the language identifier in the `language` directory. | ||
- You can copy the original json file and rename it. | ||
4. Translate the contents of the `tip` attribute. | ||
|
||
## 3. Add a new completion | ||
|
||
1. Run it in the project root directory. `.\script\create.ps1` | ||
2. Follow the prompts. | ||
3. Modify the new completion. | ||
4. Add this completion to the value of the `list` property in `completions.json` in the project root directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
--- | ||
layout: home | ||
hero: | ||
name: PSCompletions | ||
tagline: A completion manager for better and simpler use completions in PowerShell. | ||
actions: | ||
- theme: brand | ||
text: About module command | ||
link: en-US/command | ||
- theme: alt | ||
text: About the structure of json file | ||
link: en-US/completion | ||
- theme: alt | ||
text: About PR (Pull Request) | ||
link: en-US/contribute | ||
features: | ||
- title: Multi-language | ||
details: Switch between languages(zh-CN,en-US...) freely. | ||
- title: Sort dynamically | ||
details: Sort completion tab dynamically by frequency of use. | ||
- title: New Completions menu | ||
details: The module provides a more useful completion menu | ||
- title: Base-in-json | ||
details: Define completion data from json files. | ||
--- | ||
|
||
waiting... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: 模块命令 | ||
next: | ||
text: 关于贡献 | ||
link: '../contribute/index.md' | ||
--- | ||
|
||
- 等待补充... | ||
- 可以使用 `psc` 触发补全,通过补全提示信息了解模块命令 | ||
- 通过项目的 README 了解 | ||
- 输入 `psc` 后 按下 `enter`,将会打印一些模块信息 |
Oops, something went wrong.