-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInitialize-PSFavorite.ps1
More file actions
36 lines (32 loc) 路 1.44 KB
/
Copy pathInitialize-PSFavorite.ps1
File metadata and controls
36 lines (32 loc) 路 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<#
.SYNOPSIS
Initializes the PSFavorite module
.DESCRIPTION
The Initialize-PSFavorite function is used to initialize the PSFavorite module by providing it the
path to the configuration file and the key combination to add a new favorite.
Both of these parameters are optional.
The default location for the configuration is:
`$Env:LOCALAPPDATA\PSFavorite\Favorites.txt` on Windows and
`~/.local/share/PSFavorite/Favorites.txt` on Linux and macOS.
The default keybinding to add a favorite is "Ctrl+Shift+*".
.EXAMPLE
Initialize-PSFavorite
Initializes the PSFavorite module using the default configuration and keybindings.
.EXAMPLE
Initialize-PSFavorite -FavoritesPath "C:\PSFavorite\Config.txt" -Key "Ctrl+Shift+F"
Initializes the PSFavorite module by creating a configuration file at "C:\PSFavorite\Config.txt"
and registers the key combination "Ctrl+Shift+F" to add a favorite.
#>
function Initialize-PSFavorite(
# Path to the configuration file
[Alias("ConfigPath", "ConfigFile", "FavoritesFile", "Path", "Name", "FullName", "FullPath")]
[string] $FavoritesPath,
# Key combination to add a favorite
[Alias("Keybind", "Keybinding", "KeyCombo", "KeyCombination")]
[string] $Key = "Ctrl+Shift+*"
) {
# Initialize the configuration file and predictor
Initialize-Configuration -FavoritesPath $FavoritesPath
# Register the Add-PSFavorite KeyHandler
Register-KeyHandler -Key $Key
}