diff options
author | Alex McGrath <amk@amk.ie> | 2021-11-24 13:52:21 +0000 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtz.pm> | 2021-11-24 15:04:36 +0100 |
commit | bbb92bbfa026bdd0bab7ea64230a07aa70f98ba2 (patch) | |
tree | a7e824bea6b48ab937b2373777bd5c4a564eda28 | |
parent | Tidy things (diff) |
Only use first line of `password-cmd` output
-rw-r--r-- | config.go | 6 | ||||
-rw-r--r-- | doc/senpai.5.scd | 3 |
2 files changed, 6 insertions, 3 deletions
@@ -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 |