WinPkgScan.psm1

# WinPkgScan module.
#
# One command runs WinPkgScan.ps1, which ships in this module folder:
#
# WinPkgScan open the app
# WinPkgScan scan -Csv -Html scan (read-only)
# WinPkgScan delete -WhatIf preview removing the marked folders
# WinPkgScan help scan every option of a command
#
# Invoke-WinPkgScan is the full name; WinPkgScan is its alias.

$WinPkgScanScript = Join-Path $PSScriptRoot 'WinPkgScan.ps1'

function Invoke-WinPkgScan {
    <#
    .SYNOPSIS
        Runs WinPkgScan: the app, or a command such as scan, delete, restore,
        schedule, install or uninstall.
 
    .DESCRIPTION
        Finds leftover app folders of removed Microsoft Store apps in
        %LOCALAPPDATA%\Packages, and safely removes the ones you choose.
        Run "WinPkgScan help" for the commands and "WinPkgScan help <command>"
        for every option of one.
 
    .EXAMPLE
        WinPkgScan scan -Csv -Html -Open
 
    .EXAMPLE
        WinPkgScan delete -WhatIf
    #>

    # The script runs as a script, so its "exit" never closes this window.
    & $WinPkgScanScript @args
}

Set-Alias -Name WinPkgScan -Value Invoke-WinPkgScan

Export-ModuleMember -Function 'Invoke-WinPkgScan' -Alias 'WinPkgScan'