Skip to content

Commit

Permalink
Merge pull request #4731 from facutuesca/powershell-completion-doc
Browse files Browse the repository at this point in the history
doc: Add instructions to configure PowerShell completions
  • Loading branch information
MichaelEischer committed Mar 28, 2024
2 parents 63a2350 + 15555c9 commit 870904d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc/020_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
in Debian and derivatives. Please look up the correct path in the appropriate
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"

0 comments on commit 870904d

Please sign in to comment.