简体中文 | English | Github | Gitee
Tip
PowerShell
: A cross-platform PowerShell. Start it by runningpwsh
/pwsh.exe
.Windows PowerShell
: A PowerShell which is built-in on Windows system. Start it by runningpowershell
/powershell.exe
.- They can both use
PSCompletions
, butPowerShell
is more recommended.
- A completion manager in
PowerShell
for better and simpler use completions. - Manage completions together.
- Switch between languages(
en-US
,zh-CN
,...) freely. - Sort completion items dynamically by frequency of use.
- Provide a more powerful completion menu.
- Combined with argc-completions.
If PSCompletions
is helpful to you, please consider giving it a star ⭐.
- See the CHANGELOG for details.
- See the FAQ.
-
Start
PowerShell
. -
Install module:
- Don't omit
-Scope CurrentUser
unless you're sure you'll always startPowerShell
with administrator permissions.Install-Module PSCompletions -Scope CurrentUser
- Install silently:
Install-Module PSCompletions -Scope CurrentUser -Repository PSGallery -Force
- Don't omit
-
Import module:
Import-Module PSCompletions
- Add it to your
$PROFILE
to make it permanent by running the following command.echo "Import-Module PSCompletions" >> $PROFILE
- Add it to your
Warning
- When using
PSCompletions
, don't useSet-PSReadLineKeyHandler -Key <key> -Function MenuComplete
. - Because
PSCompletions
uses it, if it's used again, it will overwrite the settings inPSCompletions
, causing thePSCompletions
completion menu to not work properly. - You should set it by the configuration in
PSCompletions
. - For detail configuration, see About the completion trigger key.
+ Import-Module PSCompletions
- Set-PSReadLineKeyHandler -Key <key> -Function MenuComplete
- Start
PowerShell
. - Uninstall module:
Uninstall-Module PSCompletions
Tip
- Available Completions.
- If it doesn't include the completion you want, you can submit an issue.
- You can also combined with argc-completions.
- Take
git
as an example.
psc add git
- Then you can enter
git
, pressSpace
andTab
key to get command completion. - For more usages on
psc
, you just need to enterpsc
, pressSpace
andTab
key, and you will get all usages ofpsc
by reading the completion tip.
- See the CONTRIBUTING for details.
PSCompletions
uses theTab
key by default.- You can set it by running
psc menu config trigger_key <key>
.
Warning
- When using
PSCompletions
, don't useSet-PSReadLineKeyHandler -Key <key> -Function MenuComplete
. - Because
PSCompletions
uses it, if it's used again, it will overwrite the settings inPSCompletions
, causing thePSCompletions
completion menu to not work properly.
+ Import-Module PSCompletions
- Set-PSReadLineKeyHandler -Key <key> -Function MenuComplete
- When
PSCompletions
module is imported after startingPowerShell
, it will start a background job to check for the completion status of the remote repository. - After getting the update,
PSCompletions
will show the latest status of the completions in the next time.
Optional Completion
: some command completions that like-*
, such as--global
ingit config --global
.- You should use option completion first.
- Taking
git
as an example, if you want to entergit config user.name --global xxx
, you should use--global
completion first, and then useuser.name
, and then enter the namexxx
.
-
In addition to the built-in completion menu of
PowerShell
,PSCompletions
module also provides a more powerful completion menu.- Setting:
psc menu config enable_menu 1
(Default:1
)
- Setting:
-
The module's completion menu is based on PS-GuiCompletion realization idea, thanks!
-
Available Windows environment:
-
Some keys in the module's completion menu.
-
Apply the selected completion item:
Enter
- You can also use
Tab
orSpace
when there's only one completion.
- You can also use
-
Delete filter characters:
Backspace
-
Exit the completion menu:
Esc
/Ctrl + c
- You can also use
Backspace
when there're no characters in the filter area.
- You can also use
-
Select completion item:
Select previous item Select next item Up
Down
Left
Right
Shift + Tab
Tab
Shift + Space
Space
Ctrl + u
Ctrl + d
Ctrl + p
Ctrl + n
-
-
All configurations of it, you can trigger completion by running
psc menu
, then learn about them by the completion tip.- For configured values,
1
meanstrue
and0
meansfalse
. (It applies to all configurations ofPSCompletions
)
- For configured values,
-
Setting:
psc menu config enable_menu_enhance 1
(Default:1
) -
Now,
PSCompletions
has two completion implementations.Register-ArgumentCompleter
Set-PSReadLineKeyHandler
- : It's used by default.
- Requires:
enable_menu
andenable_menu_enhance
both set to1
.
- Requires:
- It no longer needs to loop through registering
Register-ArgumentCompleter
for all completions, which theoretically makes loading faster. - It use
TabExpansion2
to manage completions globally, not limited to those added bypsc add
.- For example:
- Path completion such as
cd
/.\
/..\
/~\
/... inPowerShell
. - Build-in commands such as
Get-*
/Set-*
/New-*
/... inPowerShell
. - Completion registered by
Register-ArgumentCompleter
- Combined with argc-completions.
- Completion registered by cli or module.
- ...
- Path completion such as
- For example:
- : It's used by default.
Tip
- Due to future changes in Windows Terminal, 😄🤔😎 will not be displayed properly in the completion menu, so these three default special symbols will change.
- Related issue: microsoft/terminal#18242
- The changes are as follows:
😄
=>»
🤔
=>?
😎
=>!
-
Special symbols after the completion item are used to let you know in advance if completions are available before you press the
Tab
key.- They only exist in completions added by
psc add
. - You can hide them by replacing them with the empty string.
psc menu symbol SpaceTab ""
psc menu symbol OptionTab ""
psc menu symbol WriteSpaceTab ""
- They only exist in completions added by
-
»
,?
,!
: If there are multiple, you can choose the effect of one of them.- Define them:
Normal Completion
: Sub-commands. Such asadd
/pull
/push
/commit
/... ingit
.Optional Completion
: Optional parameters. Such as-g
/-u
/... ingit add
.General Optional Completion
: General optional parameters that can be used with any command. Such as--help
/... ingit
.
»
: It means that after you apply it, you can pressSpace
andTab
key to continue to getNormal Completion
orOptional Completion
.- It will appear only when there's
Normal Completion
orOptional Completion
. - It can be customized by running
psc menu symbol SpaceTab <symbol>
- It will appear only when there's
?
: It means that after you apply it (Optional Completion
), you can pressSpace
andTab
key to continue to get otherOptional Completion
.General Optional Completion
use also this symbol.- It can be customized by running
psc menu symbol OptionTab <symbol>
!
: It means that after you apply it (Optional Completion
orGeneral Optional Completion
), you can pressSpace
and enter a string, then pressSpace
andTab
key to continue to get otherOptional Completion
orGeneral Optional Completion
.- If the string has Spaces, Please use
"
(quote) or'
(single quote) to wrap it. e.g."test content"
- If there's also
»
, it means that there'sNormal Completion
, you can pressSpace
andTab
key to continue to get them without entering a string. - It can be customized by running
psc menu symbol WriteSpaceTab <symbol>
- If the string has Spaces, Please use
- All completions can be triggered by pressing the
Tab
key after entering a part.
- Define them:
-
The completion tip is only a helper, you can also disable the tip by running
psc menu config enable_tip 0
- To enable the completion tip, run
psc menu config enable_tip 1
. - You can also disable the tip for a specific completion, such as
psc
.psc completion psc enable_tip 0
- To enable the completion tip, run
-
General structure of the completion tip:
Usage
+Description
+Example
U: install|add [-g|-u] [options] <app> This is a description of the command. E: install xxx add -g xxx
-
Example Analysis:
- Usage: Begin with
U:
- command name:
install
- command alias:
add
- required parameters:
<app>
app
is a simple summary of the parameters.
- optional parameters:
-g
-u
[options]
: Some options.
- command name:
- Description: The description of the command.
- Example: Begin with
E:
- Usage: Begin with
Global language
: Default to the language of current system.- You can show it by running
psc config language
. - You can change it by running
psc config language zh-CN
.
- You can show it by running
Completion language
: The language set for the specified completion.- e.g.
psc completion git language en-US
.
- e.g.
Available language
: In the completionconfig.json
file, there is alanguage
attribute whose value is a list of available languages.
- Get the specified language:
- If there is
Completion language
,use it. - If not, use
Global language
.
- If there is
- Determine the final language:
- Determine whether the value of the first step exists in
Available language
. - If it exists, use it.
- If not, use the first of the
Available language
. (It's usuallyen-US
)
- Determine whether the value of the first step exists in
- Take
git
for example, when enteringgit add
, pressing theSpace
andTab
keys, path completion will not be triggered, only completion provided by the module will be triggered. - If you want to trigger path completion, you need to enter a content which matches
^(?:\.\.?|~)?(?:[/\\]).*
. - e.g.
- Please enter
./
or.\
and pressTab
key to get path completion for the subdirectory or file. - Please enter
../
or..\
and pressTab
key to get path completion for the parent directory or file. - Please enter
/
or\
and pressTab
key to get path completion for the sibling directory. - More examples:
~/
/../../
...
- Please enter
- So you can enter
git add ./
and then pressTab
key to get the path completion.
- Guide
Completion
:Click to view to the official website of the command. Sort by first letter(0-9,a-z).- Special case:
abc(a)
, it means that you need to download it bypsc add abc
, but by defaulta
is used instead ofabc
to trigger the completion.
- Special case:
Language
: Supported Languages, and Translation Progress.- The translation progress is compared to
en-US
.
- The translation progress is compared to
Description
: Command Description.
Completion | Language | Description |
---|---|---|
7z | en-US zh-CN(100%) |
The command line cli of 7-Zip |
arch | en-US zh-CN(100%) |
Display machine architecture. Completion was written based on uutils/coreutils. |
b2sum | en-US zh-CN(14%) |
Compute and check message digests. Completion was written based on uutils/coreutils. |
b3sum | en-US zh-CN(14%) |
Compute and check message digests. Completion was written based on uutils/coreutils. |
base32 | en-US zh-CN(33%) |
Encode/decode data and print to standard output. Completion was written based on uutils/coreutils. |
base64 | en-US zh-CN(33%) |
Encode/decode data and print to standard output. Completion was written based on uutils/coreutils. |
basename | en-US zh-CN(33%) |
Print NAME with any leading directory components removed. Completion was written based on uutils/coreutils. |
basenc | en-US zh-CN(14%) |
Encode/decode data and print to standard output. Completion was written based on uutils/coreutils. |
bun | en-US zh-CN(100%) |
Bun - JavaScript all-in-one toolkit. |
cargo | en-US zh-CN(100%) |
cargo - Rust package manager. |
chfs | en-US zh-CN(100%) |
CuteHttpFileServer - A free, HTTP protocol file sharing server cross-platform file sharing server. |
choco | en-US zh-CN(100%) |
choco(chocolatey) - Software Manager. |
cksum | en-US zh-CN(22%) |
Print CRC and size for each file. Completion was written based on uutils/coreutils. |
comm | en-US zh-CN(22%) |
Compare two sorted files line by line. Completion was written based on uutils/coreutils. |
conda | en-US zh-CN(100%) |
conda - binary package and environment manager. |
csplit | en-US zh-CN(20%) |
Split a file into sections determined by context lines. Completion was written based on uutils/coreutils. |
cut | en-US zh-CN(16%) |
Print specified byte or field columns from each line of stdin or the input files. Completion was written based on uutils/coreutils. |
date | en-US zh-CN(15%) |
Print or set the system date and time. Completion was written based on uutils/coreutils. |
dd | en-US zh-CN(100%) |
Copy, and optionally convert, a file system resource. Completion was written based on uutils/coreutils. |
deno | en-US zh-CN(100%) |
Deno - A secure runtime for JavaScript and TypeScript. |
df | en-US zh-CN(5%) |
Show information about the file system on which each FILE resides, or all file systems by default. Completion was written based on uutils/coreutils. |
dircolors | en-US zh-CN(28%) |
Output commands to set the LS_COLORS environment variable. Completion was written based on uutils/coreutils. |
dirname | en-US zh-CN(50%) |
Strip last component from file name. Completion was written based on uutils/coreutils. |
docker | en-US zh-CN(100%) |
docker - Container Application Development. |
du | en-US zh-CN(4%) |
Estimate file space usage. Completion was written based on uutils/coreutils. |
env | en-US zh-CN(18%) |
Set each NAME to VALUE in the environment and run COMMAND. Completion was written based on uutils/coreutils. |
factor | en-US zh-CN(50%) |
Print the prime factors of the given NUMBER(s). Completion was written based on uutils/coreutils. |
fmt | en-US zh-CN(12%) |
Reformat paragraphs from input files (or stdin) to stdout. Completion was written based on uutils/coreutils. |
fnm | en-US zh-CN(12%) |
Fast and simple Node.js version manager, built in Rust. |
fold | en-US zh-CN(33%) |
Writes each file (or standard input if no files are given) to standard output whilst breaking long lines. Completion was written based on uutils/coreutils. |
git | en-US zh-CN(98%) |
Git - Version control system. |
hashsum | en-US zh-CN(6%) |
Compute and check message digests. Completion was written based on uutils/coreutils. |
head | en-US zh-CN(25%) |
Print the first 10 lines of each 'FILE' to standard output. Completion was written based on uutils/coreutils. |
join | en-US zh-CN(12%) |
For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks. Completion was written based on uutils/coreutils. |
kubectl | en-US zh-CN(100%) |
Kubernetes, also known as K8s, is an open source system for automating deployment, scaling, and management of containerized applications. kubectl is its command-line tool. |
link | en-US zh-CN(100%) |
Call the link function to create a link named FILE2 to an existing FILE1. Completion was written based on uutils/coreutils. |
ln | en-US zh-CN(12%) |
Make links between files. Completion was written based on uutils/coreutils. |
md5sum | en-US zh-CN(15%) |
Compute and check message digests. Completion was written based on uutils/coreutils. |
mktemp | en-US zh-CN(22%) |
Create a temporary file or directory. Completion was written based on uutils/coreutils. |
ngrok | en-US zh-CN(100%) |
ngrok - Unified Ingress Platform for developers. Connect localhost to the internet for testing applications and APIs. |
nl | en-US zh-CN(6%) |
Number lines of files. Completion was written based on uutils/coreutils. |
npm | en-US zh-CN(100%) |
npm - package manager. |
nproc | en-US zh-CN(40%) |
Print the number of cores available to the current process. Completion was written based on uutils/coreutils. |
nrm | en-US zh-CN(100%) |
nrm - npm registry manager. |
numfmt | en-US zh-CN(8%) |
Convert numbers from/to human-readable strings. Completion was written based on uutils/coreutils. |
nvm | en-US zh-CN(100%) |
nvm - Node Version Manager. |
od | en-US zh-CN(4%) |
Dump files in octal and other formats. Completion was written based on uutils/coreutils. |
paste | en-US zh-CN(33%) |
Write lines consisting of the sequentially corresponding lines from each 'FILE', separated by 'TAB's, to standard output. Completion was written based on uutils/coreutils. |
pdm | en-US zh-CN(0%) |
A modern Python package and dependency manager supporting the latest PEP standards. |
pip | en-US zh-CN(99%) |
pip - Python Package Manager. |
pnpm | en-US zh-CN(100%) |
pnpm - Package Manager. |
powershell | en-US zh-CN(100%) |
Windows PowerShell CLI. (powershell.exe) |
psc | en-US zh-CN(100%) |
PSCompletions module's completion tips. It can only be updated, not removed. If removed, it will be automatically added again. |
pwsh | en-US zh-CN(100%) |
PowerShell CLI. (pwsh.exe) |
python | en-US zh-CN(100%) |
python - command-line. |
scoop | en-US zh-CN(100%) |
Scoop - Software Manager. |
sfsu | en-US zh-CN(6%) |
Scoop utilities that can replace the slowest parts of Scoop, and run anywhere from 30-100 times faster. |
volta | en-US zh-CN(100%) |
volta - Accessible JavaScript Tool Manager. |
winget | en-US zh-CN(100%) |
WinGet - Windows package manager. |
wsl | en-US zh-CN(100%) |
WSL - Windows Subsystem for Linux. |
wt | en-US zh-CN(100%) |
Windows Terminal command line. You can use it to start a terminal. |
yarn | en-US zh-CN(100%) |
yarn - package manager. |
... | ... | ... |