diff --git a/cli/cli.go b/cli/cli.go index b6098ac..5860534 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -129,13 +129,13 @@ func New(cfg *config.XCConfig, backend store.Backend) (*Cli, error) { cli.usePasswordMgr = true } } - remote.Initialize(cli.sshThreads, cli.user) remote.SetPrependHostnames(cli.prependHostnames) remote.SetRemoteTmpdir(cfg.RemoteTmpdir) remote.SetProgressBar(cli.progressBar) remote.SetConnectTimeout(cli.connectTimeout) remote.SetDebug(cli.debug) + remote.SetUsePasswordManager(cli.usePasswordMgr) // interpreter cli.setInterpreter("none", cfg.Interpreter) @@ -185,7 +185,7 @@ func (c *Cli) setPrompt() { } if rts != "" { - if c.raisePasswd == "" { + if c.raisePasswd == "" && !c.usePasswordMgr { rts += "*" rtbold = true } @@ -431,14 +431,14 @@ func (c *Cli) dorunscript(mode execMode, argsLine string) { r.Print() } -func doOnOff(propName string, propRef *bool, args []string) { +func doOnOff(propName string, propRef *bool, args []string) bool { if len(args) < 1 { value := "off" if *propRef { value = "on" } term.Warnf("%s is %s\n", propName, value) - return + return false } switch args[0] { case "on": @@ -447,8 +447,9 @@ func doOnOff(propName string, propRef *bool, args []string) { *propRef = false default: term.Errorf("Invalid %s vaue. Please use either \"on\" or \"off\"\n", propName) - return + return false } + return true } func (c *Cli) setRaiseType(rt string) { diff --git a/cli/handlers.go b/cli/handlers.go index 5b81492..adc6fb9 100644 --- a/cli/handlers.go +++ b/cli/handlers.go @@ -276,27 +276,31 @@ func (c *Cli) doDelay(name string, argsLine string, args ...string) { } func (c *Cli) doDebug(name string, argsLine string, args ...string) { - doOnOff("debug", &c.debug, args) - remote.SetDebug(c.debug) + if doOnOff("debug", &c.debug, args) { + remote.SetDebug(c.debug) + } } func (c *Cli) doProgressBar(name string, argsLine string, args ...string) { - doOnOff("progressbar", &c.progressBar, args) - remote.SetProgressBar(c.progressBar) + if doOnOff("progressbar", &c.progressBar, args) { + remote.SetProgressBar(c.progressBar) + } } func (c *Cli) doPrependHostnames(name string, argsLine string, args ...string) { - doOnOff("prepend_hostnames", &c.prependHostnames, args) - remote.SetPrependHostnames(c.prependHostnames) + if doOnOff("prepend_hostnames", &c.prependHostnames, args) { + remote.SetPrependHostnames(c.prependHostnames) + } } func (c *Cli) doUsePasswordManager(name string, argsLine string, args ...string) { - doOnOff("use_password_manager", &c.usePasswordMgr, args) - if c.usePasswordMgr && !passmgr.Ready() { - term.Errorf("Password manager is not ready\n") - c.usePasswordMgr = false + if doOnOff("use_password_manager", &c.usePasswordMgr, args) { + if c.usePasswordMgr && !passmgr.Ready() { + term.Errorf("Password manager is not ready\n") + c.usePasswordMgr = false + } + remote.SetUsePasswordManager(c.usePasswordMgr) } - remote.SetUsePasswordManager(c.usePasswordMgr) } func (c *Cli) doReload(name string, argsLine string, args ...string) {