diff --git a/src/sshSupport.test.ts b/src/sshSupport.test.ts index e723eff9..c7feea8c 100644 --- a/src/sshSupport.test.ts +++ b/src/sshSupport.test.ts @@ -40,3 +40,31 @@ Host coder-vscode--* ProxyCommand: '/tmp/coder --header="X-FOO=bar" coder.dev', }) }) + +it("handles ? wildcards", () => { + const properties = computeSSHProperties( + "coder-vscode--testing", + `Host * + StrictHostKeyChecking yes + +Host i-???????? i-????????????????? + User test + +# --- START CODER VSCODE --- +Host coder-v?ode--* + StrictHostKeyChecking yes + Another=false +Host coder-v?code--* + StrictHostKeyChecking no + Another=true + ProxyCommand=/tmp/coder --header="X-BAR=foo" coder.dev +# --- END CODER VSCODE --- +`, + ) + + expect(properties).toEqual({ + Another: "true", + StrictHostKeyChecking: "yes", + ProxyCommand: '/tmp/coder --header="X-BAR=foo" coder.dev', + }) +}) diff --git a/src/sshSupport.ts b/src/sshSupport.ts index 8e30d0cf..67966f5a 100644 --- a/src/sshSupport.ts +++ b/src/sshSupport.ts @@ -85,7 +85,8 @@ export function computeSSHProperties(host: string, config: string): Record