About S4Utils
A PowerShell module for this bucket, which contains several functions to help building app manifests.
- New-ProfileModifier
- Add-ProfileContent
- Remove-ProfileContent
- Mount-ExternalRuntimeData
- Dismount-ExternalRuntimeData
Generate scripts which modifies PowerShell profile.
Parameters | Type | Mandatory | Descriptions |
---|---|---|---|
Type |
String | ✓ | Type of scripts to generate, support ImportModule , RemoveModule in current version. |
Name |
String | ✓ | Use the name of manifest file. |
BucketDir |
String | ✓ | Path of Scoop4kariiin bucket root directory. |
ModuleName |
String | ✗ | Value of name in psmodule field, use this parameter if it differs from manifest name. |
- See Windows-screenFetch manifest for example.
Add certain content to PowerShell profile. Scripts generated by New-ProfileModifier
will call this function.
Parameters | Type | Mandatory | Descriptions |
---|---|---|---|
Content |
String | ✓ | Content to be added. |
- See Windows-screenFetch manifest for example.
Remove certain content from PowerShell profile. Scripts generated by New-ProfileModifier
will call this function.
Parameters | Type | Mandatory | Descriptions |
---|---|---|---|
Content |
String | ✓ | Content to be removed. |
- See Windows-screenFetch manifest for example.
Mount external runtime data.
Parameters | Type | Mandatory | Descriptions |
---|---|---|---|
Source |
String | ✓ | Source folder persisted in $persist_dir , support Persist as alias. |
Target |
String | ✗ | The target path, which is the actual path app uses to access the runtime data. |
AppData |
Switch | ✗ | Use this parameter if target folder locates in $env:APPDATA using the name of persisted folder, value of $Target will be forced overwritten. |
- Either
Target
orAppData
should be specified. - See lne-link manifest for example.
Unmount external runtime data.
Parameters | Type | Mandatory | Descriptions |
---|---|---|---|
Path |
String | ✓ | The target path, which is the actual path app uses to access the runtime data, support Name , Target as alias. Or just use the folder name with AppData parameter. |
AppData |
Switch | ✗ | Use this parameter if target folder locates in $env:APPDATA using the name of persisted folder, value of $Path will be forced overwritten. |
- See lne-link manifest for example.
# Get the path of S4Utils.
# Find-BucketDirectory is a function added by scoop which helps generating bucket path.
# For Name parameter, use $bucket in installation-ish processes, use $install.bucket in uninstallation-ish processes.
$S4UtilsPath = Find-BucketDirectory -Root -Name $bucket | Join-Path -ChildPath "scripts\S4Utils.psm1"
# Import and use if exists.
if (Test-Path $S4UtilsPath) {
Unblock-File $S4UtilsPath # Unblock file to avoid permission issues.
Import-Module $S4UtilsPath
... # Call functions according to demands.
Remove-Module -Name S4Utils -ErrorAction SilentlyContinue # Remove it to avoid conflicts.
}