Fix directory change lag (#672)

This commit is contained in:
JT
2022-01-05 16:50:27 +11:00
committed by GitHub
parent c158d29577
commit affb9696c7
5 changed files with 21 additions and 17 deletions

View File

@ -18,6 +18,7 @@ use sys_locale::get_locale;
pub use unit::*;
use std::collections::HashMap;
use std::path::PathBuf;
use std::{cmp::Ordering, fmt::Debug};
use crate::ast::{CellPath, PathMember};
@ -173,6 +174,17 @@ impl Value {
}
}
pub fn as_path(&self) -> Result<PathBuf, ShellError> {
match self {
Value::String { val, .. } => Ok(PathBuf::from(val)),
x => Err(ShellError::CantConvert(
"path".into(),
x.get_type().to_string(),
self.span()?,
)),
}
}
pub fn as_block(&self) -> Result<BlockId, ShellError> {
match self {
Value::Block { val, .. } => Ok(*val),