Merge pull request #862 from Detegr/master

Fix `enter` crashing on nonexistent file
This commit is contained in:
Andrés N. Robalino 2019-10-22 07:40:23 -05:00 committed by GitHub
commit 5b701cd197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,6 @@
use crate::commands::command::CommandAction; use crate::commands::command::CommandAction;
use crate::commands::PerItemCommand; use crate::commands::PerItemCommand;
use crate::commands::UnevaluatedCallInfo; use crate::commands::UnevaluatedCallInfo;
use crate::data::meta::Span;
use crate::errors::ShellError; use crate::errors::ShellError;
use crate::parser::registry; use crate::parser::registry;
use crate::prelude::*; use crate::prelude::*;
@ -34,10 +33,12 @@ impl PerItemCommand for Enter {
match call_info.args.expect_nth(0)? { match call_info.args.expect_nth(0)? {
Tagged { Tagged {
item: Value::Primitive(Primitive::Path(location)), item: Value::Primitive(Primitive::Path(location)),
tag,
.. ..
} => { } => {
let location_string = location.display().to_string(); let location_string = location.display().to_string();
let location_clone = location_string.clone(); let location_clone = location_string.clone();
let tag_clone = tag.clone();
if location.starts_with("help") { if location.starts_with("help") {
let spec = location_string.split(":").collect::<Vec<&str>>(); let spec = location_string.split(":").collect::<Vec<&str>>();
@ -71,9 +72,8 @@ impl PerItemCommand for Enter {
crate::commands::open::fetch( crate::commands::open::fetch(
&full_path, &full_path,
&location_clone, &location_clone,
Span::unknown(), tag_clone.span,
) ).await?;
.await.unwrap();
match contents { match contents {
Value::Primitive(Primitive::String(_)) => { Value::Primitive(Primitive::String(_)) => {