Skip to content

Commit 4342a66

Browse files
committed
Fix target names containing "-v" result in going to the version branch instead of ssh-ing
1 parent be4d192 commit 4342a66

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

app/SshEnvApp.ps1

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function Invoke-SshEnvApp {
4848
Assert-CorrectSshKeyPermissions
4949

5050
switch -Regex ($args[0]) {
51-
'agent' {
51+
'^(agent)$' {
5252
switch ($args[1]) {
5353
'status' {
5454
Write-SshAgentStatus
@@ -91,7 +91,7 @@ function Invoke-SshEnvApp {
9191
break
9292
}
9393

94-
'datadir' {
94+
'^(datadir)$' {
9595
switch ($args[1]) {
9696
'clone' {
9797
Initialize-DataDirViaGitClone
@@ -157,7 +157,7 @@ function Invoke-SshEnvApp {
157157
}
158158

159159

160-
'key' {
160+
'^(key)$' {
161161
switch ($args[1]) {
162162
'create' {
163163
New-SshKeyPair
@@ -212,12 +212,12 @@ function Invoke-SshEnvApp {
212212
break
213213
}
214214

215-
'sysinfo' {
215+
'^(sysinfo)$' {
216216
Write-SysInfo
217217
break
218218
}
219219

220-
'version|--version|-v' {
220+
'^(version|--version|-v)$' {
221221
$version = Get-EnvVersion
222222
Write-Host "ssh-env version $version"
223223

@@ -227,12 +227,12 @@ function Invoke-SshEnvApp {
227227
break
228228
}
229229

230-
'-h|--help|help' {
230+
'^(-h|--help|help)$' {
231231
Write-Help
232232
break
233233
}
234234

235-
'ssh' {
235+
'^(ssh)$' {
236236
$sshArgs = $args[1..$args.Length] # Remove first item ('ssh')
237237
Invoke-SshWithAgent @sshArgs
238238
break

0 commit comments

Comments
 (0)