fix(fill): Add terminal-width argument to explicitly define terminal's width (#3090)

Add `terminal-width` argument to explicitly define terminal's width
Update pwsh,bash,zsh,fish init scripts with `terminal-width` argument

Co-authored-by: Kevin Song <chips@ksong.dev>
Co-authored-by: Kevin Song <4605384+chipbuster@users.noreply.github.com>
This commit is contained in:
Rashil Gandhi
2021-10-07 03:06:28 +05:30
committed by GitHub
parent 3c995d3e3e
commit 6464693165
6 changed files with 26 additions and 9 deletions
+7 -3
View File
@@ -131,6 +131,12 @@ impl<'a> Context<'a> {
let right = arguments.is_present("right");
let width = arguments
.value_of("terminal_width")
.and_then(|w| w.parse().ok())
.or_else(|| terminal_size().map(|(w, _)| w.0 as usize))
.unwrap_or(80);
Context {
config,
properties,
@@ -141,9 +147,7 @@ impl<'a> Context<'a> {
repo: OnceCell::new(),
shell,
right,
width: terminal_size()
.map(|(w, _)| w.0 as usize)
.unwrap_or_default(),
width,
#[cfg(test)]
env: HashMap::new(),
#[cfg(test)]