-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpacman-apt.psm1
More file actions
61 lines (54 loc) · 1.59 KB
/
pacman-apt.psm1
File metadata and controls
61 lines (54 loc) · 1.59 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# choco -> apt
Set-Alias -Name "apt" choco
Set-Alias -Name "apt-get" choco
# scoop -> pacman
function pacman {
[CmdletBinding(DefaultParameterSetName='Default')]
param (
[Parameter(Mandatory=$true, ParameterSetName='S', Position=0)]
[Alias('S')]
[switch]$Install,
[Parameter(Mandatory=$true, ParameterSetName='R', Position=0)]
[Alias('R')]
[switch]$Remove,
[Parameter(Mandatory=$true, ParameterSetName='Sy', Position=0)]
[Alias('Sy')]
[switch]$Upgrade,
[Parameter(Mandatory=$true, ParameterSetName='Syu', Position=0)]
[Alias('Syu')]
[switch]$UpgradeAll,
[Parameter(Mandatory=$false, Position=1)]
[string]$PackageName
)
switch ($PSCmdlet.ParameterSetName) {
'S' {
if ($PackageName) {
scoop install $PackageName
} else {
Write-Host "Package name is required for the '-S' command"
}
}
'R' {
if ($PackageName) {
scoop uninstall $PackageName
} else {
Write-Host "Package name is required for the '-R' command"
}
}
'Sy' {
if ($PackageName) {
scoop update $PackageName
} else {
Write-Host "Package name is required for the '-Sy' command"
}
}
'Syu' {
scoop update *
}
default {
Write-Host "Unsupported pacman command"
}
}
}
Export-ModuleMember -Function pacman
Export-ModuleMember -Alias apt