fix: #3809, try to fix the source -h not work issue (#4627)

This commit is contained in:
Justin Ma 2022-02-24 23:32:10 +08:00 committed by GitHub
parent c984ce9dc9
commit 2c9d8c4818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1543,6 +1543,18 @@ pub fn parse_source(
let (call, err) = parse_internal_call(working_set, spans[0], &spans[1..], decl_id);
error = error.or(err);
if error.is_some() || call.has_flag("help") {
return (
Pipeline::from_vec(vec![Expression {
expr: Expr::Call(call),
span: span(spans),
ty: Type::Unknown,
custom_completion: None,
}]),
error,
);
}
// Command and one file name
if spans.len() >= 2 {
let name_expr = working_set.get_span_contents(spans[1]);