-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaliases.ps1
More file actions
207 lines (135 loc) · 5 KB
/
Copy pathaliases.ps1
File metadata and controls
207 lines (135 loc) · 5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#region Alias
function CreateAlias {
Set-Alias -Name $args[0] -Value $args[1] -Description "#$($args[2])" -Scope Script
}
CreateAlias "ca" CreateAlias
function Alias {
Get-Alias | Where-Object {$_.Description -Match "^#"} | Select-Object -Property Name, ReferencedCommand, @{Name = 'Description'; Expression = {$_.Description -replace "#",""}}
}
CreateAlias "ali" Alias
function AliasHelp {
Get-Alias -Name $args[0] | Select-Object -Property ReferencedCommand, @{Name = 'Description'; Expression = {$_.Description -replace "#",""}} | Format-List
}
CreateAlias "alih" AliasHelp
#endregion
#region Files
function RemoveRecurseForce { Remove-Item -Recurse -Force $args }
CreateAlias "rmrf" RemoveRecurseForce
#endregion
#region Node
function NpmRun { npm run $args }
CreateAlias "npmr" NpmRun
function NpmCheck { npx npm-check $args }
CreateAlias "npmc" NpmCheck
function NpmCheckUpdate { npx npm-check -u $args }
CreateAlias "npmcup" NpmCheckUpdate
#endregion
#region git
CreateAlias "g" git "Alias for git, type 'g alias' for a list of git aliases"
function GitPush { git push $args }
CreateAlias "gpsh" GitPush
function GitPushForce { git push --force $args }
CreateAlias "gpshf" GitPushForce
function GitPublish { git push -u (git remote) (git rev-parse --abbrev-ref HEAD) }
CreateAlias "gpub" GitPublish
function GitPull { git pull $args }
CreateAlias "gpl" GitPull
function GitPullRebase { git pull --rebase $args }
CreateAlias "gplr" GitPullRebase
function GitCheckout { git checkout $args }
CreateAlias "gco" GitCheckout
function GitCheckoutTrack { git checkout -t $args }
CreateAlias "gcot" GitCheckoutTrack "Git: Checkout and track remote branch`n
Example: gcot origin/feature/abc"
function GitCheckoutBranch { git checkout -b $args }
CreateAlias "gcob" GitCheckoutBranch "Git: Create branch and checkout`n
Example: gcob feature/abc"
function GitBranchDelete { git branch -D $args[0]; git push (git remote) --delete $args[0] }
CreateAlias "gbd" GitBranchDelete "Git: Delete local and remote branch`n
Example: gbd test-branch"
function GitFlowFeatureStart {
git flow feature start -F $args
}
CreateAlias "gffs" GitFlowFeatureStart
function GitFlowFeaturePublish {
git flow feature publish $args
}
CreateAlias "gffp" GitFlowFeaturePublish
function GitFlowBugfixStart {
git flow bugfix start -F $args
}
CreateAlias "gfbs" GitFlowBugfixStart
function GitFlowBugfixPublish {
git flow bugfix publish $args
}
CreateAlias "gfbp" GitFlowBugfixPublish
function GitFlowHotfixStart {
git flow hotfix start -F $args
}
CreateAlias "gfhs" GitFlowHotfixStart
function GitFlowHotfixPublish {
git flow hotfix publish $args
}
CreateAlias "gfhp" GitFlowHotfixPublish
function GitFlowHotfixFinish {
git flow hotfix finish -F -p -m "Release" $args
}
CreateAlias "gfhf" GitFlowHotfixFinish
function GitFlowReleaseStart {
git flow release start -F $args
}
CreateAlias "gfrs" GitFlowReleaseStart
function GitFlowReleasePublish {
git flow release publish $args
}
CreateAlias "gfrp" GitFlowReleasePublish
function GitFlowReleaseFinish {
git flow release finish -F -p -m "Release" $args
}
CreateAlias "gfrf" GitFlowReleaseFinish
function GitDiscard { git reset --hard; git clean -fd }
CreateAlias "gdc" GitDiscard
function GitClean { git clean -xfd }
CreateAlias "gcl" GitClean "Git: Remove untracked files, including ignored ones"
function GitCheckIgnoreVerbose { git check-ignore -v $args }
CreateAlias "gciv" GitCheckIgnoredVerbose "Git: Show ignore reason, including matching pattern"
function GitHash { git rev-parse --short HEAD }
CreateAlias "ghsh" GitHash
function GitStashStaged { git stash save --keep-index --include-untracked "remove-unstaged" }
CreateAlias "gss" GitStashStaged
function GitSyncTags { git fetch --prune --pruneTags }
CreateAlias "gst" GitSyncTags "Git: Sync tags with remote"
#endregion
#region Docker
function DockerDesktop { Start-Process -FilePath "C:\Program Files\Docker\Docker\Docker for Windows.exe" }
CreateAlias "dd" DockerDesktop
function DockerCompose { docker-compose $args }
CreateAlias "dc" DockerCompose
function DockerComposeLinux { $env:COMPOSE_CONVERT_WINDOWS_PATHS=1; docker-compose $args }
CreateAlias "dcl" DockerCompose
function DockerComposeWindows { $env:COMPOSE_CONVERT_WINDOWS_PATHS=0; docker-compose $args }
CreateAlias "dcw" DockerCompose
#endregion
#region Network
function FlushDns { ipconfig /flushdns }
CreateAlias "fldns" FlushDns
#endregion
#region Display
function FixStuckWindow { Start-Process "tskill dwm" }
#endregion
#region Util
# Replacement for &&
# Usage:
# command1; aa command2
function aa() {
if($?) {
$command = [string]::join(' ', $args[1..99])
& $args[0] $command
}
}
function ReloadPath { $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") }
CreateAlias "relpath" ReloadPath
CreateAlias "time" Measure-Command "Example: time { npm ci }"
function UpdateTime { W32tm /resync /force }
CreateAlias "uptm" UpdateTime
#endregion