pub fn get_screen_width() -> u16
Examples found in repository?
src/list/grid.rs (line 32)
30
31
32
33
34
35
36
37
38
39
40
41
42
43
    pub fn fit_into_screen<'a>(&'a mut self) -> impl std::fmt::Display + 'a {
        if self.term_width.is_none() {
            let w = get_screen_width();
            self.term_width = Some(w as usize);
        }

        let width = self.term_width.unwrap();
        if width > 0 {
            if let Some(grid_display) = self.grid.fit_into_width(width) {
                return grid_display;
            }
        }
        self.grid.fit_into_columns(1)
    }
More examples
Hide additional examples
src/list/list_impl.rs (line 77)
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
fn convert_opt<T>(opt: ListOptions, t: T) -> ListOptions<Table, T> {
    ListOptions {
        display_style: match opt.display_style {
            DisplayStyle::Short(style, _) => DisplayStyle::Short(style, t),
            DisplayStyle::Long(_) => {
                time_fmt::init();
                let mut table = Table::new(gen_title());
                table.set_width(get_screen_width());
                DisplayStyle::Long(table)
            }
        },
        grouping: opt.grouping,
        queries: opt.queries,
        plain: opt.plain,
        limit: opt.limit,
    }
}