add comments
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed

This commit is contained in:
Andrew Woodlee 2025-01-23 16:47:43 -06:00
parent 8c633fd4b2
commit 5d3c265ce9

View File

@ -34,15 +34,17 @@ var Sprintf = fmt.Sprintf
func (command *Command) RunCmd(cmdCtxLogger zerolog.Logger, opts *ConfigOpts) ([]string, error) { func (command *Command) RunCmd(cmdCtxLogger zerolog.Logger, opts *ConfigOpts) ([]string, error) {
var ( var (
outputArr []string ArgsStr string // concatenating the arguments
ArgsStr string
cmdOutBuf bytes.Buffer cmdOutBuf bytes.Buffer
cmdOutWriters io.Writer cmdOutWriters io.Writer
errSSH error
envVars = environmentVars{ envVars = environmentVars{
file: command.Env, file: command.Env,
env: command.Environment, env: command.Environment,
} }
outputArr []string // holds the output strings returned by processes
) )
// Get the command type // Get the command type
@ -53,13 +55,13 @@ func (command *Command) RunCmd(cmdCtxLogger zerolog.Logger, opts *ConfigOpts) ([
ArgsStr += fmt.Sprintf(" %s", v) ArgsStr += fmt.Sprintf(" %s", v)
} }
// print the user's password if it is updated
if command.Type == "user" { if command.Type == "user" {
if command.UserOperation == "password" { if command.UserOperation == "password" {
cmdCtxLogger.Info().Str("password", command.UserPassword).Msg("user password to be updated") cmdCtxLogger.Info().Str("password", command.UserPassword).Msg("user password to be updated")
} }
} }
var errSSH error
// is host defined // is host defined
if command.Host != nil { if command.Host != nil {
outputArr, errSSH = command.RunCmdSSH(cmdCtxLogger, opts) outputArr, errSSH = command.RunCmdSSH(cmdCtxLogger, opts)