feat: Use Raw Text to save if pipeline data is ExternalStream (#7082)

if not value type or Value as String in nushell, save will use raw type
This commit is contained in:
Access
2022-11-21 09:32:15 +08:00
committed by GitHub
parent d9d6cea5a9
commit 899383c30c
2 changed files with 24 additions and 0 deletions

View File

@ -121,6 +121,11 @@ impl Command for Save {
let ext = if raw {
None
// if is extern stream , in other words , not value
} else if let PipelineData::ExternalStream { .. } = input {
None
} else if let PipelineData::Value(Value::String { .. }, ..) = input {
None
} else {
path.extension()
.map(|name| name.to_string_lossy().to_string())