1
0
Fork 0
mirror of synced 2024-06-28 11:41:11 -04:00

Add PowerShell uninstall script

sitiom 2020-11-22 08:32:21 +08:00
parent 396c41c1f6
commit c881d563ed

@ -186,3 +186,17 @@ for section in conf:
print("Removing ", realpath)
os.unlink(realpath)
```
Here's an equivalent script for PowerShell ([source](https://github.com/anishathalye/dotfiles_template/pull/19#issuecomment-729518540), [powershell-yaml](https://github.com/cloudbase/powershell-yaml) required)
```ps
$CONFIG = "install.conf.yaml"
$confObj = ConvertFrom-Yaml ([string](Get-Content $CONFIG -Raw))
foreach ($target in ($confObj | Where-Object Keys -eq link).Values.Keys) {
if ((Get-Item $target -Force -ErrorAction SilentlyContinue).LinkType -eq "SymbolicLink") {
Write-Host "Removing $target" -ForegroundColor Red
Remove-Item $target
}
}
```