mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 10:25:42 +02:00
Default alignment (#2481)
* WIP - compiling but not working * semi-working * making progress * working except for table lines * fmt + clippy * cleaned up some comments * working line colors * fmt, clippy, updated sample config.toml * merges * fixed bug where no config.toml or not set settings made weird defaults. * clippy & fmt again * Header default alignment is left. Co-authored-by: Andrés N. Robalino <andres@androbtech.com>
This commit is contained in:
@ -7,7 +7,7 @@ fn main() {
|
||||
let width = args[1].parse::<usize>().expect("Need a width in columns");
|
||||
let msg = args[2..]
|
||||
.iter()
|
||||
.map(|x| StyledString::new(x.to_owned(), TextStyle::basic()))
|
||||
.map(|x| StyledString::new(x.to_owned(), TextStyle::basic_left()))
|
||||
.collect();
|
||||
|
||||
let t = Table::new(
|
||||
|
@ -217,9 +217,9 @@ impl TextStyle {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn basic() -> TextStyle {
|
||||
pub fn basic_center() -> TextStyle {
|
||||
TextStyle::new()
|
||||
.alignment(Alignment::Left)
|
||||
.alignment(Alignment::Center)
|
||||
.style(Style::default())
|
||||
}
|
||||
|
||||
@ -229,6 +229,12 @@ impl TextStyle {
|
||||
.style(Style::default())
|
||||
}
|
||||
|
||||
pub fn basic_left() -> TextStyle {
|
||||
TextStyle::new()
|
||||
.alignment(Alignment::Left)
|
||||
.style(Style::default())
|
||||
}
|
||||
|
||||
pub fn default_header() -> TextStyle {
|
||||
TextStyle::new()
|
||||
.alignment(Alignment::Center)
|
||||
|
Reference in New Issue
Block a user