mirror of
https://github.com/restic/restic.git
synced 2024-12-23 00:07:25 +00:00
doc: Add instructions to configure PowerShell completions
This commit is contained in:
parent
9284f7413a
commit
521713fc94
1 changed files with 15 additions and 0 deletions
|
@ -362,3 +362,18 @@ Example for using sudo to write a zsh completion script directly to the system-w
|
||||||
the operating system used, e.g. ``/usr/share/bash-completion/completions/restic``
|
the operating system used, e.g. ``/usr/share/bash-completion/completions/restic``
|
||||||
in Debian and derivatives. Please look up the correct path in the appropriate
|
in Debian and derivatives. Please look up the correct path in the appropriate
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
|
Example for setting up a powershell completion script for the local user's profile:
|
||||||
|
|
||||||
|
.. code-block:: pwsh-session
|
||||||
|
|
||||||
|
# Create profile if one does not exist
|
||||||
|
PS> If (!(Test-Path $PROFILE.CurrentUserAllHosts)) {New-Item -Path $PROFILE.CurrentUserAllHosts -Force}
|
||||||
|
|
||||||
|
PS> $ProfileDir = (Get-Item $PROFILE.CurrentUserAllHosts).Directory
|
||||||
|
|
||||||
|
# Generate Restic completions in the same directory as the profile
|
||||||
|
PS> restic generate --powershell-completion "$ProfileDir\restic-completion.ps1"
|
||||||
|
|
||||||
|
# Append to the profile file the command to load Restic completions
|
||||||
|
PS> Add-Content -Path $Profile.CurrentUserAllHosts -Value "`r`nImport-Module $ProfileDir\restic-completion.ps1"
|
||||||
|
|
Loading…
Reference in a new issue