fixup! fixup! Add POSIX shell support

This commit is contained in:
Cole Helbling 2020-03-29 14:15:38 -07:00
parent 2a890aee27
commit a7f3c6040c
No known key found for this signature in database
GPG Key ID: B37E0F2371016A4C
1 changed files with 9 additions and 10 deletions

View File

@ -38,21 +38,20 @@ impl Init {
let stdout = io::stdout(); let stdout = io::stdout();
let mut handle = stdout.lock(); let mut handle = stdout.lock();
writeln!(handle, "{}", config.z)?; // If any `writeln!` call fails to write to stdout, we assume the user's
// computer is on fire and panic.
writeln!(handle, "{}", config.z).unwrap();
if !self.no_define_aliases { if !self.no_define_aliases {
writeln!(handle, "{}", config.alias)?; writeln!(handle, "{}", config.alias).unwrap();
} }
match self.hook { match self.hook {
Hook::none => (), Hook::none => (),
Hook::prompt => writeln!(handle, "{}", config.hook.prompt)?, Hook::prompt => writeln!(handle, "{}", config.hook.prompt).unwrap(),
Hook::pwd => { Hook::pwd => match config.hook.pwd {
if let Some(pwd_hook) = config.hook.pwd { Some(pwd_hook) => writeln!(handle, "{}", pwd_hook).unwrap(),
writeln!(handle, "{}", pwd_hook)?; None => bail!("PWD hooks are currently unsupported on this shell."),
} else { },
bail!("PWD hooks are currently unsupported on this shell.");
}
}
} }
Ok(()) Ok(())