|
4 | 4 | # =============================================== |
5 | 5 |
|
6 | 6 | # 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 |
9 | 10 | 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 } |
16 | 23 |
|
17 | 24 | # 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 } |
21 | 37 |
|
22 | 38 | # 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 } |
29 | 55 |
|
30 | 56 | # 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 } |
37 | 69 |
|
38 | 70 | # 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 } |
0 commit comments