You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -95,7 +98,7 @@ impl PluginCommand for DcmPluginCommand {
95
98
.extra_description("Parse DICOM objects from files or binary data. Invalid DICOM objects are reported as errors and excluded from the output unless --error flag is used.")
96
99
}
97
100
98
-
fnexamples(&self) -> Vec<Example>{
101
+
fnexamples(&self) -> Vec<Example<'_>>{
99
102
vec![
100
103
Example{
101
104
description:"Parse a DICOM file by passing binary data",
@@ -124,59 +127,74 @@ impl PluginCommand for DcmPluginCommand {
124
127
.get_current_dir()
125
128
.map(PathBuf::from);
126
129
127
-
letspan = input
130
+
letinput_span = input
128
131
.span()
129
132
.unwrap_or(call.head);
130
133
let input_metadata = input.metadata();
131
134
132
-
// Convert input PipelineData to Value. The default behaviour for BinaryStream is to detect the type of the stream and if unknown, try to read it as a UTF-8 string.
133
-
// This behaviour is wrong for us, since we want to read any binary input stream as binary data.
134
-
// Unfortunately, a list of `[(`open file.dcm`), ...]` gets converted to a list of strings by nushell before we can access it.
135
-
let input = ifletPipelineData::ByteStream(byte_stream, ..) = input {
136
-
// TODO eventually support streaming?
137
-
let bytes = byte_stream.into_bytes()?;
138
-
Value::binary(bytes, span)
139
-
}else{
140
-
// convert PipelineData to Value the usual way
141
-
input.into_value(span)?
142
-
};
143
-
144
-
let error_column = call.get_flag_value("error");
145
-
let error_column = ifletSome(Value::String{ val, .. }) = error_column {
146
-
Some(val)
147
-
}else{
148
-
None
149
-
};
135
+
let error_column = call.get_flag::<String>("error")?;
150
136
151
137
// run
152
-
let output = self.run_filter(plugin, current_dir.as_deref(),&input, error_column)?;
138
+
// TODO find a way without cloning? ListStream::map() requires 'static lifetime, maybe I can use iterators directly?
139
+
let output = self.process_pipeline_data(plugin.clone(), current_dir, error_column,&input_span, input)?;
153
140
154
141
// Forward DataSource metadata from input to output, but clear any content type. This keeps the source.
155
142
let output_metadata = input_metadata.map(|m| m.with_content_type(None));
0 commit comments