(
&self,
_plugin: &Self::Plugin,
_engine: &nu_plugin::EngineInterface,
call: &EvaluatedCall,
input: &Value,
)
| 410 | } |
| 411 | |
| 412 | fn run( |
| 413 | &self, |
| 414 | _plugin: &Self::Plugin, |
| 415 | _engine: &nu_plugin::EngineInterface, |
| 416 | call: &EvaluatedCall, |
| 417 | input: &Value, |
| 418 | ) -> Result<Value, LabeledError> { |
| 419 | match input.as_list() { |
| 420 | Ok(list) => { |
| 421 | if list.is_empty() { |
| 422 | return Err(LabeledError::new("Can't plot a zero element list.").with_label( "No elements in the list.", call.head)); |
| 423 | } |
| 424 | let (value_type, list_len_op) = check_equality_of_list(list, call)?; |
| 425 | |
| 426 | // if in fact we have a nested list |
| 427 | if let Some(_len) = list_len_op { |
| 428 | // we haven't implemented this yet |
| 429 | self.plot_nested(call, input) |
| 430 | } else { |
| 431 | // we have a normal plot, single list of numbers |
| 432 | match value_type { |
| 433 | Type::Float | Type::Int => self.plot(call, input), |
| 434 | e => Err(LabeledError::new(format!("List type is {}, but should be float or int.", e)).with_label("Incorrect List type.", call.head)), |
| 435 | } |
| 436 | } |
| 437 | }, |
| 438 | Err(e) => Err(LabeledError::new(format!("Input type should be a list: {}.", e)).with_label( "Incorrect input type.", call.head)), |
| 439 | } |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | impl Plotter for CommandHist { |
nothing calls this directly
no test coverage detected