forked from extern/nushell
Move us away from mixing OOP and spreadsheet to just spreadsheet
This commit is contained in:
@ -238,7 +238,7 @@ impl ExternalCommand {
|
||||
if let Some(span) = span {
|
||||
return Err(ShellError::labeled_error(
|
||||
"External $it needs string data",
|
||||
"given object instead of string data",
|
||||
"given row instead of string data",
|
||||
span,
|
||||
));
|
||||
} else {
|
||||
@ -293,7 +293,7 @@ impl ExternalCommand {
|
||||
}
|
||||
return Err(ShellError::labeled_error(
|
||||
"External $it needs string data",
|
||||
"given object instead of string data",
|
||||
"given row instead of string data",
|
||||
span,
|
||||
));
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ fn to_bson(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream
|
||||
Value::Binary(x).simple_spanned(name_span),
|
||||
),
|
||||
_ => yield Err(ShellError::labeled_error_with_secondary(
|
||||
"Expected an object with BSON-compatible structure.span() from pipeline",
|
||||
"Expected a table with BSON-compatible structure.span() from pipeline",
|
||||
"requires BSON-compatible input",
|
||||
name_span,
|
||||
"originates from here".to_string(),
|
||||
@ -265,7 +265,7 @@ fn to_bson(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream
|
||||
}
|
||||
}
|
||||
_ => yield Err(ShellError::labeled_error(
|
||||
"Expected an object with BSON-compatible structure from pipeline",
|
||||
"Expected a table with BSON-compatible structure from pipeline",
|
||||
"requires BSON-compatible input",
|
||||
name_span))
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ fn to_csv(
|
||||
}
|
||||
_ => {
|
||||
yield Err(ShellError::labeled_error_with_secondary(
|
||||
"Expected an object with CSV-compatible structure.span() from pipeline",
|
||||
"Expected a table with CSV-compatible structure.span() from pipeline",
|
||||
"requires CSV-compatible input",
|
||||
name_span,
|
||||
"originates from here".to_string(),
|
||||
|
@ -100,7 +100,7 @@ fn to_json(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream
|
||||
Value::Primitive(Primitive::String(x)).simple_spanned(name_span),
|
||||
),
|
||||
_ => yield Err(ShellError::labeled_error_with_secondary(
|
||||
"Expected an object with JSON-compatible structure.span() from pipeline",
|
||||
"Expected a table with JSON-compatible structure.span() from pipeline",
|
||||
"requires JSON-compatible input",
|
||||
name_span,
|
||||
"originates from here".to_string(),
|
||||
@ -109,7 +109,7 @@ fn to_json(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream
|
||||
}
|
||||
}
|
||||
_ => yield Err(ShellError::labeled_error(
|
||||
"Expected an object with JSON-compatible structure from pipeline",
|
||||
"Expected a table with JSON-compatible structure from pipeline",
|
||||
"requires JSON-compatible input",
|
||||
name_span))
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ fn sqlite_input_stream_to_bytes(
|
||||
other => {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
format!("Expected object, found {:?}", other),
|
||||
format!("Expected row, found {:?}", other),
|
||||
))
|
||||
}
|
||||
}
|
||||
@ -207,7 +207,7 @@ fn to_sqlite(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStre
|
||||
Ok(out) => yield ReturnSuccess::value(out),
|
||||
_ => {
|
||||
yield Err(ShellError::labeled_error(
|
||||
"Expected an object with SQLite-compatible structure.span() from pipeline",
|
||||
"Expected a table with SQLite-compatible structure.span() from pipeline",
|
||||
"requires SQLite-compatible input",
|
||||
name_span,
|
||||
))
|
||||
|
@ -95,7 +95,7 @@ fn to_toml(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream
|
||||
Value::Primitive(Primitive::String(x)).simple_spanned(name_span),
|
||||
),
|
||||
_ => yield Err(ShellError::labeled_error_with_secondary(
|
||||
"Expected an object with TOML-compatible structure.span() from pipeline",
|
||||
"Expected a table with TOML-compatible structure.span() from pipeline",
|
||||
"requires TOML-compatible input",
|
||||
name_span,
|
||||
"originates from here".to_string(),
|
||||
@ -104,7 +104,7 @@ fn to_toml(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream
|
||||
}
|
||||
}
|
||||
_ => yield Err(ShellError::labeled_error(
|
||||
"Expected an object with TOML-compatible structure from pipeline",
|
||||
"Expected a table with TOML-compatible structure from pipeline",
|
||||
"requires TOML-compatible input",
|
||||
name_span))
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ fn to_string_helper(v: &Value) -> Result<String, ShellError> {
|
||||
Value::Primitive(Primitive::Date(d)) => Ok(d.to_string()),
|
||||
Value::Primitive(Primitive::Bytes(b)) => Ok(format!("{}", b)),
|
||||
Value::Primitive(Primitive::Boolean(_)) => Ok(v.as_string()?),
|
||||
Value::List(_) => return Ok(String::from("[list list]")),
|
||||
Value::Object(_) => return Ok(String::from("[object]")),
|
||||
Value::List(_) => return Ok(String::from("[table]")),
|
||||
Value::Object(_) => return Ok(String::from("[row]")),
|
||||
Value::Primitive(Primitive::String(s)) => return Ok(s.to_string()),
|
||||
_ => Err(ShellError::string("Unexpected value")),
|
||||
}
|
||||
@ -152,7 +152,7 @@ fn to_tsv(
|
||||
}
|
||||
_ => {
|
||||
yield Err(ShellError::labeled_error_with_secondary(
|
||||
"Expected an object with TSV-compatible structure.span() from pipeline",
|
||||
"Expected a table with TSV-compatible structure.span() from pipeline",
|
||||
"requires TSV-compatible input",
|
||||
name_span,
|
||||
"originates from here".to_string(),
|
||||
|
@ -96,7 +96,7 @@ fn to_yaml(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream
|
||||
Value::Primitive(Primitive::String(x)).simple_spanned(name_span),
|
||||
),
|
||||
_ => yield Err(ShellError::labeled_error_with_secondary(
|
||||
"Expected an object with YAML-compatible structure.span() from pipeline",
|
||||
"Expected a table with YAML-compatible structure.span() from pipeline",
|
||||
"requires YAML-compatible input",
|
||||
name_span,
|
||||
"originates from here".to_string(),
|
||||
@ -105,7 +105,7 @@ fn to_yaml(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream
|
||||
}
|
||||
}
|
||||
_ => yield Err(ShellError::labeled_error(
|
||||
"Expected an object with YAML-compatible structure from pipeline",
|
||||
"Expected a table with YAML-compatible structure from pipeline",
|
||||
"requires YAML-compatible input",
|
||||
name_span))
|
||||
}
|
||||
|
Reference in New Issue
Block a user