From 2c9d8c4818beaf57ddb766f3074d93641b953f1f Mon Sep 17 00:00:00 2001 From: Justin Ma Date: Thu, 24 Feb 2022 23:32:10 +0800 Subject: [PATCH] fix: #3809, try to fix the `source -h` not work issue (#4627) --- crates/nu-parser/src/parse_keywords.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/nu-parser/src/parse_keywords.rs b/crates/nu-parser/src/parse_keywords.rs index b277ecd495..a54e0daed6 100644 --- a/crates/nu-parser/src/parse_keywords.rs +++ b/crates/nu-parser/src/parse_keywords.rs @@ -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]);