mirror of
https://github.com/appleboy/drone-ssh.git
synced 2026-06-04 10:15:07 +08:00
style: improve code readability with consistent multi-line formatting
- Add golines to the list of golangci-lint formatters - Format multi-line env variable declarations for CLI flags for consistency - Split string slice initializations onto multiple lines for improved readability in tests - Use multi-line function calls for better readability in plugin and test code - Improve readability of script command appends in logic and tests Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
@@ -84,9 +84,14 @@ func main() {
|
||||
EnvVars: []string{"PLUGIN_SSH_KEY", "PLUGIN_KEY", "SSH_KEY", "INPUT_KEY"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ssh-passphrase",
|
||||
Usage: "The purpose of the passphrase is usually to encrypt the private key.",
|
||||
EnvVars: []string{"PLUGIN_SSH_PASSPHRASE", "PLUGIN_PASSPHRASE", "SSH_PASSPHRASE", "INPUT_PASSPHRASE"},
|
||||
Name: "ssh-passphrase",
|
||||
Usage: "The purpose of the passphrase is usually to encrypt the private key.",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_SSH_PASSPHRASE",
|
||||
"PLUGIN_PASSPHRASE",
|
||||
"SSH_PASSPHRASE",
|
||||
"INPUT_PASSPHRASE",
|
||||
},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "key-path",
|
||||
@@ -100,9 +105,13 @@ func main() {
|
||||
EnvVars: []string{"PLUGIN_CIPHERS", "SSH_CIPHERS", "INPUT_CIPHERS"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "useInsecureCipher",
|
||||
Usage: "include more ciphers with use_insecure_cipher",
|
||||
EnvVars: []string{"PLUGIN_USE_INSECURE_CIPHER", "SSH_USE_INSECURE_CIPHER", "INPUT_USE_INSECURE_CIPHER"},
|
||||
Name: "useInsecureCipher",
|
||||
Usage: "include more ciphers with use_insecure_cipher",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_USE_INSECURE_CIPHER",
|
||||
"SSH_USE_INSECURE_CIPHER",
|
||||
"INPUT_USE_INSECURE_CIPHER",
|
||||
},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "fingerprint",
|
||||
@@ -118,8 +127,12 @@ func main() {
|
||||
Name: "command.timeout",
|
||||
Aliases: []string{"T"},
|
||||
Usage: "command timeout",
|
||||
EnvVars: []string{"PLUGIN_COMMAND_TIMEOUT", "SSH_COMMAND_TIMEOUT", "INPUT_COMMAND_TIMEOUT"},
|
||||
Value: 10 * time.Minute,
|
||||
EnvVars: []string{
|
||||
"PLUGIN_COMMAND_TIMEOUT",
|
||||
"SSH_COMMAND_TIMEOUT",
|
||||
"INPUT_COMMAND_TIMEOUT",
|
||||
},
|
||||
Value: 10 * time.Minute,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "script",
|
||||
@@ -154,36 +167,63 @@ func main() {
|
||||
Value: "22",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "proxy.protocol",
|
||||
Usage: "The IP protocol to use for the proxy. Valid values are \"tcp\". \"tcp4\" or \"tcp6\". Default to tcp.",
|
||||
EnvVars: []string{"PLUGIN_PROXY_PROTOCOL", "SSH_PROXY_PROTOCOL", "INPUT_PROXY_PROTOCOL"},
|
||||
Value: "tcp",
|
||||
Name: "proxy.protocol",
|
||||
Usage: "The IP protocol to use for the proxy. Valid values are \"tcp\". \"tcp4\" or \"tcp6\". Default to tcp.",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_PROXY_PROTOCOL",
|
||||
"SSH_PROXY_PROTOCOL",
|
||||
"INPUT_PROXY_PROTOCOL",
|
||||
},
|
||||
Value: "tcp",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "proxy.username",
|
||||
Usage: "connect as user of proxy",
|
||||
EnvVars: []string{"PLUGIN_PROXY_USERNAME", "PLUGIN_PROXY_USER", "PROXY_SSH_USERNAME", "INPUT_PROXY_USERNAME"},
|
||||
Value: "root",
|
||||
Name: "proxy.username",
|
||||
Usage: "connect as user of proxy",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_PROXY_USERNAME",
|
||||
"PLUGIN_PROXY_USER",
|
||||
"PROXY_SSH_USERNAME",
|
||||
"INPUT_PROXY_USERNAME",
|
||||
},
|
||||
Value: "root",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "proxy.password",
|
||||
Usage: "user password of proxy",
|
||||
EnvVars: []string{"PLUGIN_PROXY_PASSWORD", "PROXY_SSH_PASSWORD", "INPUT_PROXY_PASSWORD"},
|
||||
Name: "proxy.password",
|
||||
Usage: "user password of proxy",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_PROXY_PASSWORD",
|
||||
"PROXY_SSH_PASSWORD",
|
||||
"INPUT_PROXY_PASSWORD",
|
||||
},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "proxy.ssh-key",
|
||||
Usage: "private ssh key of proxy",
|
||||
EnvVars: []string{"PLUGIN_PROXY_SSH_KEY", "PLUGIN_PROXY_KEY", "PROXY_SSH_KEY", "INPUT_PROXY_KEY"},
|
||||
Name: "proxy.ssh-key",
|
||||
Usage: "private ssh key of proxy",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_PROXY_SSH_KEY",
|
||||
"PLUGIN_PROXY_KEY",
|
||||
"PROXY_SSH_KEY",
|
||||
"INPUT_PROXY_KEY",
|
||||
},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "proxy.ssh-passphrase",
|
||||
Usage: "The purpose of the passphrase is usually to encrypt the private key.",
|
||||
EnvVars: []string{"PLUGIN_PROXY_SSH_PASSPHRASE", "PLUGIN_PROXY_PASSPHRASE", "PROXY_SSH_PASSPHRASE", "INPUT_PROXY_PASSPHRASE"},
|
||||
Name: "proxy.ssh-passphrase",
|
||||
Usage: "The purpose of the passphrase is usually to encrypt the private key.",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_PROXY_SSH_PASSPHRASE",
|
||||
"PLUGIN_PROXY_PASSPHRASE",
|
||||
"PROXY_SSH_PASSPHRASE",
|
||||
"INPUT_PROXY_PASSPHRASE",
|
||||
},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "proxy.key-path",
|
||||
Usage: "ssh private key path of proxy",
|
||||
EnvVars: []string{"PLUGIN_PROXY_KEY_PATH", "PROXY_SSH_KEY_PATH", "INPUT_PROXY_KEY_PATH"},
|
||||
Name: "proxy.key-path",
|
||||
Usage: "ssh private key path of proxy",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_PROXY_KEY_PATH",
|
||||
"PROXY_SSH_KEY_PATH",
|
||||
"INPUT_PROXY_KEY_PATH",
|
||||
},
|
||||
},
|
||||
&cli.DurationFlag{
|
||||
Name: "proxy.timeout",
|
||||
@@ -196,14 +236,23 @@ func main() {
|
||||
EnvVars: []string{"PLUGIN_PROXY_CIPHERS", "PROXY_SSH_CIPHERS", "INPUT_PROXY_CIPHERS"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "proxy.useInsecureCipher",
|
||||
Usage: "include more ciphers with use_insecure_cipher",
|
||||
EnvVars: []string{"PLUGIN_PROXY_USE_INSECURE_CIPHER", "PROXY_SSH_USE_INSECURE_CIPHER", "INPUT_PROXY_USE_INSECURE_CIPHER"},
|
||||
Name: "proxy.useInsecureCipher",
|
||||
Usage: "include more ciphers with use_insecure_cipher",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_PROXY_USE_INSECURE_CIPHER",
|
||||
"PROXY_SSH_USE_INSECURE_CIPHER",
|
||||
"INPUT_PROXY_USE_INSECURE_CIPHER",
|
||||
},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "proxy.fingerprint",
|
||||
Usage: "fingerprint SHA256 of the host public key, default is to skip verification",
|
||||
EnvVars: []string{"PLUGIN_PROXY_FINGERPRINT", "PROXY_SSH_FINGERPRINT", "PROXY_FINGERPRINT", "INPUT_PROXY_FINGERPRINT"},
|
||||
Name: "proxy.fingerprint",
|
||||
Usage: "fingerprint SHA256 of the host public key, default is to skip verification",
|
||||
EnvVars: []string{
|
||||
"PLUGIN_PROXY_FINGERPRINT",
|
||||
"PROXY_SSH_FINGERPRINT",
|
||||
"PROXY_FINGERPRINT",
|
||||
"INPUT_PROXY_FINGERPRINT",
|
||||
},
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "envs",
|
||||
|
||||
Reference in New Issue
Block a user