-
Notifications
You must be signed in to change notification settings - Fork 669
feat(shell): allow configuring ssh alias #1132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cmd/limactl/shell.go
Outdated
var arg0Args []string | ||
|
||
if sshShell := os.Getenv(envShellSSH); sshShell != "" { | ||
sshShellFields := strings.Fields(sshShell) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this split the string using shell quoting semantics?
I don't know if there is a recommended function for it, but a quick search found
This seems to do what I would expect, but I haven't actually looked at the implementation:
shlex.Split("one \"two three\" four") -> []string{"one", "two three", "four"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had simple use cases in mind, but you're raising an excellent point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in b6645274..5ca81769.
PTAL
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
If the LIMASHELL_SSH environment variable is set, 'limactl shell' will consider this as an alias for the 'ssh' command to execute, instead of looking up a 'ssh' executable in the PATH. The provided command can be anything that is CLI-compatible with the OpenSSH client, such as a shell script that passes all provided arguments to 'ssh'. Signed-off-by: Antoine Cotten <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM and works as expected.
If the
SSH
environment variable is set,limactl shell
will consider this as an alias for thessh
command to execute, instead of looking up assh
executable in the PATH.The provided command can be anything that is CLI-compatible with the OpenSSH client, such as a shell script that passes all provided arguments to
ssh
.Closes #1131
Demo