diff --git a/crates/nu-command/src/viewers/table.rs b/crates/nu-command/src/viewers/table.rs index 4bd08ffe12..1cd8c1fa65 100644 --- a/crates/nu-command/src/viewers/table.rs +++ b/crates/nu-command/src/viewers/table.rs @@ -138,6 +138,11 @@ impl Command for Table { let base_pipeline = val.to_base_value(span)?.into_pipeline_data(); self.run(engine_state, stack, call, base_pipeline) } + PipelineData::Value(x @ Value::Range { .. }, ..) => Ok(Value::String { + val: x.into_string("", &config), + span: call.head, + } + .into_pipeline_data()), x => Ok(x), } } diff --git a/crates/nu-protocol/src/value/range.rs b/crates/nu-protocol/src/value/range.rs index c1b66456d2..91afd33a15 100644 --- a/crates/nu-protocol/src/value/range.rs +++ b/crates/nu-protocol/src/value/range.rs @@ -37,12 +37,12 @@ impl Range { let to = if let Value::Nothing { .. } = to { if let Ok(Value::Bool { val: true, .. }) = next.lt(expr_span, &from) { Value::Int { - val: -100i64, + val: i64::MIN, span: expr_span, } } else { Value::Int { - val: 100i64, + val: i64::MAX, span: expr_span, } } diff --git a/src/tests/test_engine.rs b/src/tests/test_engine.rs index 32d1838bc0..8a3c71ff8a 100644 --- a/src/tests/test_engine.rs +++ b/src/tests/test_engine.rs @@ -272,3 +272,8 @@ fn shortcircuiting_and() -> TestResult { fn shortcircuiting_or() -> TestResult { run_test(r#"$true || (5 / 0; $false)"#, "true") } + +#[test] +fn open_ended_range() -> TestResult { + run_test(r#"1.. | first 100000 | length"#, "100000") +}