commit bbb92bb

Alex McGrath  ·  2021-11-24 13:52:21 +0000 UTC
parent afaa452
Only use first line of `password-cmd` output
2 files changed,  +6, -3
+4, -2
 1@@ -178,8 +178,10 @@ func unmarshal(filename string, cfg *Config) (err error) {
 2 				return fmt.Errorf("error running password command: %s", err)
 3 			}
 4 
 5-			password := strings.TrimSuffix(string(stdout), "\n")
 6-			cfg.Password = &password
 7+			passCmdOut := strings.Split(string(stdout), "\n")
 8+			if len(passCmdOut) >= 1 {
 9+				cfg.Password = &passCmdOut[0]
10+			}
11 		case "channel":
12 			// TODO: does this work with soju.im/bouncer-networks extension?
13 			cfg.Channels = append(cfg.Channels, d.Params...)
+2, -1
 1@@ -40,7 +40,8 @@ Some settings are required, the others are optional.
 2 	runtime. This is useful if you store your passwords in a separate (probably
 3 	encrypted) file using `gpg` or a command line password manager such as
 4 	_pass_ or _gopass_. If a *password-cmd* is provided, the value of *password*
 5-	will be ignored and the output of *password-cmd* will be used for login.
 6+	will be ignored and the first line of the output of *password-cmd* will be
 7+	used for login.
 8 
 9 *channel*
10 	A spaced separated list of channel names that senpai will automatically join