Public/Get-AUPackages.ps1

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
<#
.SYNOPSIS
    Get AU packages
 
.DESCRIPTION
 
    Returns list of directories that have update.ps1 script in them and package name
    doesnt' start with the '_' char (unpublished packages, not considered by Update-AUPackages
    function)
 
.EXAMPLE
    gau p*
 
    Get all automatic packages that start with 'p'.
#>


function Get-AUPackages($Name=$null) {
    $root = $global:au_root
    if (!$root) { $root = '.' }
    ls $root\*\update.ps1 | % {
        $packageDir = gi (Split-Path $_)
        if ($packageDir.Name -like '_*') { return }
        if ($Name) {
            if ( $packageDir.Name -like "$Name" ) { $packageDir }
        } else { $packageDir }
    }
}

Set-Alias gau  Get-AuPackages
Set-Alias lsau Get-AuPackages