From 7e700167eefca97a18184cdea167923ae5583132 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Mon, 14 Feb 2022 21:00:11 +0800 Subject: [PATCH 1/2] fix(scoop-alias): Fix alias initialization --- CHANGELOG.md | 1 + libexec/scoop-alias.ps1 | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bfa3b5381..26c5b07d1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - **shim:** Use `-file` instead of `-command` in ps1 script shims ([#4721](https://github.com/ScoopInstaller/Scoop/issues/4721)) - **versions:** Fix wrong version number when only one version dir ([#4679](https://github.com/ScoopInstaller/Scoop/issues/4679)) - **versions:** Get current version from failed installation if possible ([#4720](https://github.com/ScoopInstaller/Scoop/issues/4720), [#4725](https://github.com/ScoopInstaller/Scoop/issues/4725)) +- **scoop-alias:** Fix alias initialization ([#4737](https://github.com/ScoopInstaller/Scoop/issues/4737)) - **scoop-checkup:** Skip 'check_windows_defender' when have not admin privileges ([#4699](https://github.com/ScoopInstaller/Scoop/issues/4699)) - **scoop-cleanup:** Remove apps other than current version ([#4665](https://github.com/ScoopInstaller/Scoop/issues/4665)) - **scoop-update:** Skip updating non git buckets ([#4670](https://github.com/ScoopInstaller/Scoop/issues/4670), [#4672](https://github.com/ScoopInstaller/Scoop/issues/4672)) diff --git a/libexec/scoop-alias.ps1 b/libexec/scoop-alias.ps1 index 6efafe8c0d..4fd1f6aa32 100644 --- a/libexec/scoop-alias.ps1 +++ b/libexec/scoop-alias.ps1 @@ -31,11 +31,11 @@ $script:config_alias = 'alias' function init_alias_config { $aliases = get_config $script:config_alias - if (!$aliases) { - $aliases = @{} + if ($aliases) { + $aliases + } else { + New-Object -TypeName PSObject } - - return $aliases } function add_alias($name, $command) { @@ -102,7 +102,7 @@ function list_aliases { if ($verbose) { return $aliases | Select-Object Name, Command, Summary | Format-Table -AutoSize -Wrap } else { - return $aliases | Select-Object Name, Command | Format-Table -AutoSize -hidetablehead -Wrap + return $aliases | Select-Object Name, Command | Format-Table -AutoSize -Wrap } } From cfd3c8e2fdb11f67e737c8d708456230fe73eed5 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Mon, 14 Feb 2022 22:16:39 +0800 Subject: [PATCH 2/2] fix(scoop-alias): Remove 'Format-Table' --- libexec/scoop-alias.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/scoop-alias.ps1 b/libexec/scoop-alias.ps1 index 4fd1f6aa32..d1f635771b 100644 --- a/libexec/scoop-alias.ps1 +++ b/libexec/scoop-alias.ps1 @@ -100,9 +100,9 @@ function list_aliases { } $aliases = $aliases.GetEnumerator() | Sort-Object Name if ($verbose) { - return $aliases | Select-Object Name, Command, Summary | Format-Table -AutoSize -Wrap + return $aliases | Select-Object Name, Command, Summary } else { - return $aliases | Select-Object Name, Command | Format-Table -AutoSize -Wrap + return $aliases | Select-Object Name, Command } }