mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
fix: Add --yes and --use-previous-options to config-ssh (#2458)
This commit is contained in:
committed by
GitHub
parent
7cce7a9c69
commit
18b0effa83
@ -138,6 +138,7 @@ func configSSH() *cobra.Command {
|
||||
var (
|
||||
sshConfigFile string
|
||||
sshConfigOpts sshConfigOptions
|
||||
usePreviousOpts bool
|
||||
coderConfigFile string
|
||||
showDiff bool
|
||||
skipProxyCommand bool
|
||||
@ -218,7 +219,9 @@ func configSSH() *cobra.Command {
|
||||
|
||||
// Avoid prompting in diff mode (unexpected behavior)
|
||||
// or when a previous config does not exist.
|
||||
if !showDiff && lastConfig != nil && !sshConfigOpts.equal(*lastConfig) {
|
||||
if usePreviousOpts && lastConfig != nil {
|
||||
sshConfigOpts = *lastConfig
|
||||
} else if !showDiff && lastConfig != nil && !sshConfigOpts.equal(*lastConfig) {
|
||||
newOpts := sshConfigOpts.asList()
|
||||
newOptsMsg := "\n\n New options: none"
|
||||
if len(newOpts) > 0 {
|
||||
@ -394,11 +397,14 @@ func configSSH() *cobra.Command {
|
||||
cmd.Flags().BoolVarP(&showDiff, "diff", "D", false, "Show diff of changes that will be made.")
|
||||
cmd.Flags().BoolVarP(&skipProxyCommand, "skip-proxy-command", "", false, "Specifies whether the ProxyCommand option should be skipped. Useful for testing.")
|
||||
_ = cmd.Flags().MarkHidden("skip-proxy-command")
|
||||
cliflag.BoolVarP(cmd.Flags(), &usePreviousOpts, "use-previous-options", "", "CODER_SSH_USE_PREVIOUS_OPTIONS", false, "Specifies whether or not to keep options from previous run of config-ssh.")
|
||||
|
||||
// Deprecated: Remove after migration period.
|
||||
cmd.Flags().StringVar(&coderConfigFile, "test.ssh-coder-config-file", sshDefaultCoderConfigFileName, "Specifies the path to an Coder SSH config file. Useful for testing.")
|
||||
_ = cmd.Flags().MarkHidden("test.ssh-coder-config-file")
|
||||
|
||||
cliui.AllowSkipPrompt(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user