1
0
mirror of https://github.com/nushell/nushell.git synced 2025-07-05 17:10:45 +02:00

this example now runs out of the box instead of failing with no value or the wrong value ()

This commit is contained in:
Michael Angerman
2021-02-19 00:40:53 -08:00
committed by GitHub
parent 7dc1d6a350
commit fc59c87606

@ -3,9 +3,18 @@ use std::collections::HashMap;
fn main() { fn main() {
let args: Vec<_> = std::env::args().collect(); let args: Vec<_> = std::env::args().collect();
let mut width = 0;
if args.len() > 1 {
// Width in terminal characters
width = args[1].parse::<usize>().expect("Need a width in columns");
}
if width < 4 {
println!("Width must be greater than or equal to 4, setting width to 80");
width = 80;
}
// Width in terminal characters
let width = args[1].parse::<usize>().expect("Need a width in columns");
// The mocked up table data // The mocked up table data
let (table_headers, row_data) = make_table_data(); let (table_headers, row_data) = make_table_data();
// The table headers // The table headers