Skip to content

Commit 11bad36

Browse files
committed
✨ feat: Remove-MyItem can rm multiple items at once
1 parent 09c8171 commit 11bad36

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

dotposh/Config/posh-aliases.ps1

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function Remove-MyItem {
9595
param (
9696
[Parameter(Mandatory = $false)]
9797
[switch]$rf,
98-
[Parameter(Mandatory = $true, Position = 0)]
99-
[string]$Path
98+
[Parameter(Mandatory = $true, Position = 0, ValueFromRemainingArguments = $true)]
99+
[string[]]$Path
100100
)
101101
Remove-Item $Path -Recurse:$rf -Force:$rf
102102
}
@@ -113,11 +113,6 @@ Set-Alias -Name 'which' -Value 'Get-CommandInfo'
113113
#Remove-Item Alias:rm -Force -ErrorAction SilentlyContinue
114114
Set-Alias -Name 'rm' -Value 'Remove-MyItem'
115115

116-
# lazygit
117-
if (Get-Command lazygit -ErrorAction SilentlyContinue) {
118-
Set-Alias -Name 'lg' -Value 'lazygit'
119-
}
120-
121116
# ----------------------------------------------------------------------------------- #
122117
# We need 'posh-alias' module to add the following aliases.
123118
if (!(Get-Command 'Add-Alias' -ErrorAction SilentlyContinue)) {
@@ -134,7 +129,7 @@ if (Get-Command eza -ErrorAction SilentlyContinue) {
134129
Add-Alias la "eza $_eza_params -al --time-style=relative --sort=modified"
135130
Add-Alias ld "eza $_eza_params -lDa --show-symlinks" # lists only directories
136131
Add-Alias lf "eza $_eza_params -lfa --show-symlinks" # lists only files (included hidden files)
137-
Add-Alias ll "eza $_eza_params -lbhHigUmuSa" # Lists everything in details of date
132+
Add-Alias ll "eza $_eza_params -lbhHigUmuSa" # Lists everything in details of date
138133
Add-Alias lt "eza $_eza_params -lT" # Tree view of detailed information
139134
Add-Alias tree "eza $_eza_params --tree" # Tree view
140135
}
@@ -161,17 +156,15 @@ Add-Alias edge 'Start-Process microsoft-edge:'
161156
# Source: - https://stackoverflow.com/questions/11546069/refreshing-restarting-powershell-session-w-out-exiting
162157
if (Test-Path -Path $PROFILE) {
163158
Add-Alias reload '. $PROFILE'
164-
}
165-
else {
159+
} else {
166160
Add-Alias reload '. $PROFILE.CurrentUserAllHosts'
167161
}
168162
Add-Alias restart 'Get-Process -Id $PID | Select-Object -ExpandProperty Path | ForEach-Object { Invoke-Command { & "$_" } -NoNewScope }'
169163

170164
# windows system
171165
if (Get-Command fastfetch -ErrorAction SilentlyContinue) {
172166
Add-Alias sysinfo 'fastfetch -c all'
173-
}
174-
else {
167+
} else {
175168
Add-Alias sysinfo 'Get-ComputerInfo'
176169
}
177170

@@ -191,4 +184,4 @@ Add-Alias HKCU: 'Set-Location HKCU:'
191184
Add-Alias npm-list '([string]::join(" ", ((npm ls -g --depth=0) | select -skip 1 | select -skiplast 1 | % { $_.remove(0,4) }))).Replace(" ","`r`n")'
192185

193186
# Use VBoxManage without adding it to PATH
194-
# Add-Alias vboxmanage '&"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" $args'
187+
# Add-Alias vboxmanage '&"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" $args'

0 commit comments

Comments
 (0)