From bbb92bbfa026bdd0bab7ea64230a07aa70f98ba2 Mon Sep 17 00:00:00 2001 From: Alex McGrath Date: Wed, 24 Nov 2021 13:52:21 +0000 Subject: Only use first line of `password-cmd` output --- config.go | 6 ++++-- doc/senpai.5.scd | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index 79c710e..d232cf4 100644 --- a/config.go +++ b/config.go @@ -178,8 +178,10 @@ func unmarshal(filename string, cfg *Config) (err error) { return fmt.Errorf("error running password command: %s", err) } - password := strings.TrimSuffix(string(stdout), "\n") - cfg.Password = &password + passCmdOut := strings.Split(string(stdout), "\n") + if len(passCmdOut) >= 1 { + cfg.Password = &passCmdOut[0] + } case "channel": // TODO: does this work with soju.im/bouncer-networks extension? cfg.Channels = append(cfg.Channels, d.Params...) diff --git a/doc/senpai.5.scd b/doc/senpai.5.scd index 8ed9ef2..79b923a 100644 --- a/doc/senpai.5.scd +++ b/doc/senpai.5.scd @@ -40,7 +40,8 @@ Some settings are required, the others are optional. runtime. This is useful if you store your passwords in a separate (probably encrypted) file using `gpg` or a command line password manager such as _pass_ or _gopass_. If a *password-cmd* is provided, the value of *password* - will be ignored and the output of *password-cmd* will be used for login. + will be ignored and the first line of the output of *password-cmd* will be + used for login. *channel* A spaced separated list of channel names that senpai will automatically join -- cgit v1.2.3