mirror of
https://github.com/nushell/nushell.git
synced 2025-06-20 01:48:09 +02:00
improve code
This commit is contained in:
parent
28ed857102
commit
b8ebb562ca
@ -283,34 +283,28 @@ fn action(input: &Value, args: &Arguments, head: Span) -> Value {
|
|||||||
internal_span,
|
internal_span,
|
||||||
} = input
|
} = input
|
||||||
{
|
{
|
||||||
match timezone {
|
if let Some(tz) = timezone {
|
||||||
None => (),
|
return Value::error(
|
||||||
Some(tz) => {
|
ShellError::IncompatibleParameters {
|
||||||
return Value::error(
|
left_message: "got a record as input".into(),
|
||||||
ShellError::IncompatibleParameters {
|
left_span: head,
|
||||||
left_message: "got a record as input".into(),
|
right_message: "the timezone should be included in the record".into(),
|
||||||
left_span: head,
|
right_span: tz.span,
|
||||||
right_message: "the timezone should be included in the record".into(),
|
},
|
||||||
right_span: tz.span,
|
head,
|
||||||
},
|
);
|
||||||
head,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match dateformat {
|
if let Some(dt) = dateformat {
|
||||||
None => (),
|
return Value::error(
|
||||||
Some(dt) => {
|
ShellError::IncompatibleParameters {
|
||||||
return Value::error(
|
left_message: "got a record as input".into(),
|
||||||
ShellError::IncompatibleParameters {
|
left_span: head,
|
||||||
left_message: "got a record as input".into(),
|
right_message: "cannot be used with records".into(),
|
||||||
left_span: head,
|
right_span: dt.span,
|
||||||
right_message: "cannot be used with records".into(),
|
},
|
||||||
right_span: dt.span,
|
head,
|
||||||
},
|
);
|
||||||
head,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return merge_record(record, head, *internal_span);
|
return merge_record(record, head, *internal_span);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user