Skip to content

Commit c079e7d

Browse files
committed
Fix Scoop update command and prevent beautifier alias expansion
- Fix suu function to use quoted '*' to prevent PowerShell expansion - Rename conflicting function names (sl->slist, sc->scleanup, si->sinstall) to prevent PowerShell-Beautifier from expanding aliases to cmdlet names - Update README documentation to reflect new function names - Add new function names to cspell dictionary
1 parent e55a75f commit c079e7d

File tree

8 files changed

+95
-173
lines changed

8 files changed

+95
-173
lines changed

Microsoft.PowerShell_profile.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ if (Test-Path $profileD) {
6363
}
6464
}
6565
}
66+
Import-Module 'A:\scoop\local\apps\scoop\current\supporting\completion\Scoop-Completion.psd1' -ErrorAction SilentlyContinue

cspell.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@
6363
"rclone",
6464
"Rustup",
6565
"rustup",
66+
"scleanup",
6667
"scriptblock",
6768
"Set-Clipboard",
69+
"sinstall",
70+
"slist",
6871
"ssh-add-if",
6972
"ssh-agent-start",
7073
"sysinfo",

profile.d/01-paths.ps1

Lines changed: 0 additions & 115 deletions
This file was deleted.

profile.d/05-scoop-completion.ps1

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ try {
1919
}
2020
# If not found via env, check the legacy path (cheap single Test-Path).
2121
# Avoid enumerating all drives; only test the legacy root quickly.
22-
# Skip A: drive check as it's usually slow on Windows
23-
# if (-not $scoopCompletion) {
24-
# $legacyRoot = 'A:\'
25-
# if (Test-Path $legacyRoot -PathType Container -ErrorAction SilentlyContinue) {
26-
# $legacy = 'A:\scoop\local\apps\scoop\current\supporting\completion\Scoop-Completion.psd1'
27-
# if (Test-Path $legacy -PathType Leaf -ErrorAction SilentlyContinue) { $scoopCompletion = $legacy }
28-
# }
29-
# }
22+
if (-not $scoopCompletion) {
23+
$legacyRoot = 'A:\'
24+
if (Test-Path $legacyRoot -PathType Container -ErrorAction SilentlyContinue) {
25+
$legacy = 'A:\scoop\local\apps\scoop\current\supporting\completion\Scoop-Completion.psd1'
26+
if (Test-Path $legacy -PathType Leaf -ErrorAction SilentlyContinue) { $scoopCompletion = $legacy }
27+
}
28+
}
3029

3130
if ($scoopCompletion) {
3231
# Register a lazy enabler that imports the Scoop completion PSD1 when the user explicitly
@@ -51,5 +50,3 @@ try {
5150
catch {
5251
if ($env:PS_PROFILE_DEBUG) { Write-Verbose "Scoop completion fragment failed: $($_.Exception.Message)" }
5352
}
54-
55-

profile.d/08-package-managers.README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ See the fragment source: `08-package-managers.ps1` for examples and usage notes.
1111

1212
Functions
1313
---------
14-
- `Set-Item` — Scoop install
14+
- `sinstall` — Scoop install
1515
- `ss` — Scoop search
1616
- `su` — Scoop update
1717
- `suu` — Scoop update all
1818
- `sr` — Scoop uninstall
19-
- `Set-Location` — Scoop list
19+
- `slist` — Scoop list
2020
- `sh` — Scoop info
21-
- `Set-Content` — Scoop cleanup
21+
- `scleanup` — Scoop cleanup
2222
- `uvi` — UV install
2323
- `uvr` — UV run
2424
- `uvx` — UV tool run

profile.d/08-package-managers.ps1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,21 @@
55

66
# Scoop shortcuts (small wrappers kept intentionally lightweight)
77
# Scoop install
8-
function Set-Item { scoop install @(); }
9-
Set-Alias Set-Item scoop -ErrorAction SilentlyContinue | Out-Null
8+
function sinstall { scoop install @(); }
109
# Scoop search
1110
function ss { scoop search $args }
1211
# Scoop update
1312
function su { scoop update $args }
1413
# Scoop update all
15-
function suu { scoop update * }
14+
function suu { scoop update '*' }
1615
# Scoop uninstall
1716
function sr { scoop uninstall $args }
1817
# Scoop list
19-
function Set-Location { scoop list $args }
18+
function slist { scoop list $args }
2019
# Scoop info
2120
function sh { scoop home $args }
2221
# Scoop cleanup
23-
function Set-Content { scoop cleanup * }
22+
function scleanup { scoop cleanup '*' }
2423

2524
# UV shortcuts
2625
# UV install

profile.d/30-dev.ps1

Lines changed: 77 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,89 @@
44
# ===============================================
55

66
# Docker shortcuts
7-
function d { docker $args }
8-
# dc: docker-compose wrapper — register a stub if not present
7+
# d: docker wrapper
8+
if (-not (Test-Path Function:d -ErrorAction SilentlyContinue)) { Set-Item -Path Function:d -Value { docker @Args } -Force | Out-Null }
9+
# dc: docker-compose wrapper
910
if (-not (Test-Path Function:dc -ErrorAction SilentlyContinue)) { Set-Item -Path Function:dc -Value { docker-compose @Args } -Force | Out-Null }
10-
function dps { docker ps $args }
11-
function di { docker images $args }
12-
function drm { docker rm $args }
13-
function drmi { docker rmi $args }
14-
function dexec { docker exec -it $args }
15-
function dlogs { docker logs $args }
11+
# dps: docker ps wrapper
12+
if (-not (Test-Path Function:dps -ErrorAction SilentlyContinue)) { Set-Item -Path Function:dps -Value { docker ps @Args } -Force | Out-Null }
13+
# di: docker images wrapper
14+
if (-not (Test-Path Function:di -ErrorAction SilentlyContinue)) { Set-Item -Path Function:di -Value { docker images @Args } -Force | Out-Null }
15+
# drm: docker rm wrapper
16+
if (-not (Test-Path Function:drm -ErrorAction SilentlyContinue)) { Set-Item -Path Function:drm -Value { docker rm @Args } -Force | Out-Null }
17+
# drmi: docker rmi wrapper
18+
if (-not (Test-Path Function:drmi -ErrorAction SilentlyContinue)) { Set-Item -Path Function:drmi -Value { docker rmi @Args } -Force | Out-Null }
19+
# dexec: docker exec -it wrapper
20+
if (-not (Test-Path Function:dexec -ErrorAction SilentlyContinue)) { Set-Item -Path Function:dexec -Value { docker exec -it @Args } -Force | Out-Null }
21+
# dlogs: docker logs wrapper
22+
if (-not (Test-Path Function:dlogs -ErrorAction SilentlyContinue)) { Set-Item -Path Function:dlogs -Value { docker logs @Args } -Force | Out-Null }
1623

1724
# Podman shortcuts
18-
function pd { podman $args }
19-
function pps { podman ps $args }
20-
function pi { podman images $args }
25+
# pd: podman wrapper
26+
if (-not (Test-Path Function:pd -ErrorAction SilentlyContinue)) { Set-Item -Path Function:pd -Value { podman @Args } -Force | Out-Null }
27+
# pps: podman ps wrapper
28+
if (-not (Test-Path Function:pps -ErrorAction SilentlyContinue)) { Set-Item -Path Function:pps -Value { podman ps $args } -Force | Out-Null }
29+
# pi: podman images wrapper
30+
if (-not (Test-Path Function:pi -ErrorAction SilentlyContinue)) { Set-Item -Path Function:pi -Value { podman images $args } -Force | Out-Null }
31+
# prmi: podman rmi wrapper
32+
if (-not (Test-Path Function:prmi -ErrorAction SilentlyContinue)) { Set-Item -Path Function:prmi -Value { podman rmi $args } -Force | Out-Null }
33+
# pdexec: podman exec -it wrapper
34+
if (-not (Test-Path Function:pdexec -ErrorAction SilentlyContinue)) { Set-Item -Path Function:pdexec -Value { podman exec -it $args } -Force | Out-Null }
35+
# pdlogs: podman logs wrapper
36+
if (-not (Test-Path Function:pdlogs -ErrorAction SilentlyContinue)) { Set-Item -Path Function:pdlogs -Value { podman logs $args } -Force | Out-Null }
2137

2238
# Node.js shortcuts
23-
function New-Item { npm install $args }
24-
function nr { npm run $args }
25-
function ns { npm start $args }
26-
function nt { npm test $args }
27-
function nb { npm run build $args }
28-
function nrd { npm run dev $args }
39+
# n: npm wrapper
40+
if (-not (Test-Path Function:n -ErrorAction SilentlyContinue)) { Set-Item -Path Function:n -Value { npm @Args } -Force | Out-Null }
41+
# ni: npm install wrapper
42+
if (-not (Test-Path Function:ni -ErrorAction SilentlyContinue)) { Set-Item -Path Function:ni -Value { npm install @Args } -Force | Out-Null }
43+
# nr: npm run wrapper
44+
if (-not (Test-Path Function:nr -ErrorAction SilentlyContinue)) { Set-Item -Path Function:nr -Value { npm run @Args } -Force | Out-Null }
45+
# ns: npm start wrapper
46+
if (-not (Test-Path Function:ns -ErrorAction SilentlyContinue)) { Set-Item -Path Function:ns -Value { npm start @Args } -Force | Out-Null }
47+
# nt: npm test wrapper
48+
if (-not (Test-Path Function:nt -ErrorAction SilentlyContinue)) { Set-Item -Path Function:nt -Value { npm test @Args } -Force | Out-Null }
49+
# np: npm publish wrapper
50+
if (-not (Test-Path Function:np -ErrorAction SilentlyContinue)) { Set-Item -Path Function:np -Value { npm publish @Args } -Force | Out-Null }
51+
# nb: npm run build wrapper
52+
if (-not (Test-Path Function:nb -ErrorAction SilentlyContinue)) { Set-Item -Path Function:nb -Value { npm run build @Args } -Force | Out-Null }
53+
# nrd: npm run dev wrapper
54+
if (-not (Test-Path Function:nrd -ErrorAction SilentlyContinue)) { Set-Item -Path Function:nrd -Value { npm run dev @Args } -Force | Out-Null }
2955

3056
# Python shortcuts
31-
function py { python $args }
32-
function venv { python -m venv $args }
33-
function activate { .\venv\Scripts\Activate.ps1 }
34-
function req { python -m pip freeze > requirements.txt }
35-
function pipi { python -m pip install $args }
36-
function pipu { python -m pip install --upgrade $args }
57+
# py: python wrapper
58+
if (-not (Test-Path Function:py -ErrorAction SilentlyContinue)) { Set-Item -Path Function:py -Value { python @Args } -Force | Out-Null }
59+
# venv: python virtual environment wrapper
60+
if (-not (Test-Path Function:venv -ErrorAction SilentlyContinue)) { Set-Item -Path Function:venv -Value { python -m venv @Args } -Force | Out-Null }
61+
# activate: activate virtual environment
62+
if (-not (Test-Path Function:activate -ErrorAction SilentlyContinue)) { Set-Item -Path Function:activate -Value { .\venv\Scripts\Activate.ps1 } -Force | Out-Null }
63+
# req: generate requirements.txt
64+
if (-not (Test-Path Function:req -ErrorAction SilentlyContinue)) { Set-Item -Path Function:req -Value { python -m pip freeze > requirements.txt } -Force | Out-Null }
65+
# pipi: pip install wrapper
66+
if (-not (Test-Path Function:pipi -ErrorAction SilentlyContinue)) { Set-Item -Path Function:pipi -Value { python -m pip install @Args } -Force | Out-Null }
67+
# pipu: pip install --upgrade wrapper
68+
if (-not (Test-Path Function:pipu -ErrorAction SilentlyContinue)) { Set-Item -Path Function:pipu -Value { python -m pip install --upgrade @Args } -Force | Out-Null }
3769

3870
# Cargo/Rust shortcuts
39-
function cr { cargo run $args }
40-
# cb (cargo build) is provided by the smaller clipboard/shortcuts fragment
41-
# (profile.d/14-clipboard.ps1) and is authoritative. The fallback definition
42-
# in this file was removed to avoid duplicate command registrations.
43-
function ct { cargo test $args }
44-
function cc { cargo check $args }
45-
function cu { cargo update $args }
46-
function ca { cargo add $args }
47-
function cw { cargo watch -x run }
48-
49-
71+
# cr: cargo run wrapper
72+
if (-not (Test-Path Function:cr -ErrorAction SilentlyContinue)) { Set-Item -Path Function:cr -Value { cargo run @Args } -Force | Out-Null }
73+
# cb: cargo build wrapper
74+
if (-not (Test-Path Function:cb -ErrorAction SilentlyContinue)) { Set-Item -Path Function:cb -Value { cargo build @Args } -Force | Out-Null }
75+
# ct: cargo test wrapper
76+
if (-not (Test-Path Function:ct -ErrorAction SilentlyContinue)) { Set-Item -Path Function:ct -Value { cargo test @Args } -Force | Out-Null }
77+
# cc: cargo check wrapper
78+
if (-not (Test-Path Function:cc -ErrorAction SilentlyContinue)) { Set-Item -Path Function:cc -Value { cargo check @Args } -Force | Out-Null }
79+
# cu: cargo update wrapper
80+
if (-not (Test-Path Function:cu -ErrorAction SilentlyContinue)) { Set-Item -Path Function:cu -Value { cargo update @Args } -Force | Out-Null }
81+
# ca: cargo add wrapper
82+
if (-not (Test-Path Function:ca -ErrorAction SilentlyContinue)) { Set-Item -Path Function:ca -Value { cargo add @Args } -Force | Out-Null }
83+
# cw: cargo watch -x run wrapper
84+
if (-not (Test-Path Function:cw -ErrorAction SilentlyContinue)) { Set-Item -Path Function:cw -Value { cargo watch -x run @Args } -Force | Out-Null }
85+
# cd: cargo doc --open wrapper
86+
if (-not (Test-Path Function:cd -ErrorAction SilentlyContinue)) { Set-Item -Path Function:cd -Value { cargo doc --open @Args } -Force | Out-Null }
87+
# cl: cargo clippy wrapper
88+
if (-not (Test-Path Function:cl -ErrorAction SilentlyContinue)) { Set-Item -Path Function:cl -Value { cargo clippy @Args } -Force | Out-Null }
89+
# cf: cargo fmt wrapper
90+
if (-not (Test-Path Function:cf -ErrorAction SilentlyContinue)) { Set-Item -Path Function:cf -Value { cargo fmt @Args } -Force | Out-Null }
91+
# ci: cargo install wrapper
92+
if (-not (Test-Path Function:ci -ErrorAction SilentlyContinue)) { Set-Item -Path Function:ci -Value { cargo install @Args } -Force | Out-Null }

scripts/data/performance-baseline.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
"Fragment": "00-bootstrap.ps1",
1616
"Raw": "32.3155,38.9279,35.1701,34.9059,38.6026"
1717
},
18-
{
19-
"MedianMs": 53.93,
20-
"MeanMs": 57.41,
21-
"Fragment": "01-paths.ps1",
22-
"Raw": "69.4518,58.0552,52.1434,53.9349,53.4412"
23-
},
2418
{
2519
"MedianMs": 68.59,
2620
"MeanMs": 66.67,

0 commit comments

Comments
 (0)