-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added support for additional OpenSSH compatibility flags. #46879
base: master
Are you sure you want to change the base?
Conversation
Added support for OpenSSH compatibility flags for interactivity (-t and -T) and version information (-V). This is for customers that alias "ssh" to "tsh ssh".
696bf61
to
6223db1
Compare
@@ -801,6 +845,11 @@ func Run(ctx context.Context, args []string, opts ...CliOption) error { | |||
ssh.Flag("log-dir", "Directory to log separated command output, when executing on multiple nodes. If set, output from each node will also be labeled in the terminal.").StringVar(&cf.SSHLogDir) | |||
ssh.Flag("no-resume", "Disable SSH connection resumption").Envar(noResumeEnvVar).BoolVar(&cf.DisableSSHResumption) | |||
ssh.Flag("relogin", "Permit performing an authentication attempt on a failed command").Default("true").BoolVar(&cf.Relogin) | |||
// The following flags are OpenSSH compatibility flags. They are not | |||
// implemented in Kingpin but are registered here to inform developers that | |||
// they are being used. Their behavior is implemented in 000000. |
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.
What is the 00000
meant to reference?
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.
Planning on putting the commit into this once I've pushed all changes.
tool/tsh/common/tsh.go
Outdated
if slices.Contains(cmdline, "-V") { | ||
modules.GetModules().PrintVersion() | ||
|
||
return nil, &common.ExitCodeError{ | ||
Code: 0, | ||
} | ||
} | ||
i := slices.Index(cmdline, "-T") | ||
if i > 0 { | ||
cmdline = slices.Replace(cmdline, i, i+1, []string{"--no-tty"}...) | ||
} |
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.
This won't handle short options grouped together in a single argument.
Kingpin's behavior already prohibits repeated short boolean flags AFAICT, so we could just have a secondary hidden flag for T
and error out if both t
and T
are passed in (even though this would still technically be in violation of the OpenSSH cli api, since that follows "last option wins" instead).
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.
@espadolini That's how I originally implemented this feature. @zmb3 you were not a fan, what do you think?
I don't have strong feelings either way.
/excludeflake * |
Added support for OpenSSH compatibility flags for interactivity (
-t
and-T
) and version information (-V
). This is for customers that aliasssh
totsh ssh
.changelog: Added support for
-t
,-T
, and-V
flags totsh
for OpenSSH compatibility.