forked from extern/nushell
Change ShellError for headers, Add sample_headers file to utils.rs
This commit is contained in:
parent
088561f6fe
commit
4cb3a6ecd7
@ -52,7 +52,7 @@ pub fn headers(
|
|||||||
}
|
}
|
||||||
}).collect())
|
}).collect())
|
||||||
}
|
}
|
||||||
_ => Err(ShellError::untagged_runtime_error("Couldn't find all headers, was the input a properly formatted, non-empty table?")),
|
_ => Err(ShellError::unexpected_eof("Could not get headers, is the table empty?", rows[0].tag.span))
|
||||||
}?;
|
}?;
|
||||||
|
|
||||||
//Each row is a dictionary with the headers as keys
|
//Each row is a dictionary with the headers as keys
|
||||||
@ -67,7 +67,7 @@ pub fn headers(
|
|||||||
}
|
}
|
||||||
yield Ok(ReturnSuccess::Value(UntaggedValue::Row(Dictionary{entries}).into_value(r.tag.clone())))
|
yield Ok(ReturnSuccess::Value(UntaggedValue::Row(Dictionary{entries}).into_value(r.tag.clone())))
|
||||||
}
|
}
|
||||||
_ => yield Err(ShellError::untagged_runtime_error("Couldn't iterate through rows, was the input a properly formatted table?"))
|
_ => yield Err(ShellError::unexpected_eof("Couldn't iterate through rows, was the input a properly formatted table?", r.tag.span))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -317,6 +317,10 @@ mod tests {
|
|||||||
loc: fixtures().join("sample_data.xlsx"),
|
loc: fixtures().join("sample_data.xlsx"),
|
||||||
at: 0
|
at: 0
|
||||||
},
|
},
|
||||||
|
Res {
|
||||||
|
loc: fixtures().join("sample_headers.xlsx"),
|
||||||
|
at: 0
|
||||||
|
},
|
||||||
Res {
|
Res {
|
||||||
loc: fixtures().join("script.nu"),
|
loc: fixtures().join("script.nu"),
|
||||||
at: 0
|
at: 0
|
||||||
|
Loading…
Reference in New Issue
Block a user