Skip to content

Latest commit

 

History

History

scripts

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

About S4Utils

A PowerShell module for this bucket, which contains several functions to help building app manifests.

Functions


New-ProfileModifier

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.

Add-ProfileContent

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.

Remove-ProfileContent

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.

Mount-ExternalRuntimeData

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.

Dismount-ExternalRuntimeData

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.

Use in manifests

# 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.
}