mirror of
https://github.com/nushell/nushell.git
synced 2025-04-13 07:48:19 +02:00
enable to-nu to include the whole dfr if rows is not specified (#4753)
This commit is contained in:
parent
69fd777120
commit
5ae5ef5146
@ -71,7 +71,12 @@ fn command(
|
||||
let values = if tail {
|
||||
df.tail(rows, call.head)?
|
||||
} else {
|
||||
df.head(rows, call.head)?
|
||||
// if rows is specified, return those rows, otherwise return everything
|
||||
if rows.is_some() {
|
||||
df.head(rows, call.head)?
|
||||
} else {
|
||||
df.head(Some(df.height()), call.head)?
|
||||
}
|
||||
};
|
||||
|
||||
let value = Value::List {
|
||||
|
@ -275,6 +275,10 @@ impl NuDataFrame {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn height(&self) -> usize {
|
||||
self.0.height()
|
||||
}
|
||||
|
||||
pub fn head(&self, rows: Option<usize>, span: Span) -> Result<Vec<Value>, ShellError> {
|
||||
let to_row = rows.unwrap_or(5);
|
||||
let values = self.to_rows(0, to_row, span)?;
|
||||
|
Loading…
Reference in New Issue
Block a user