forked from extern/nushell
Expand pwd command
Expand functionality of the pwd command to better handle the different types of shells (e.g. FilesystemShell, ValueShell, etc.).
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use crate::context::{SourceMap, SpanSource};
|
||||
use crate::data::Value;
|
||||
use crate::errors::ShellError;
|
||||
use crate::evaluate::Scope;
|
||||
use crate::data::Value;
|
||||
use crate::parser::hir;
|
||||
use crate::parser::{registry, ConfigDeserializer};
|
||||
use crate::prelude::*;
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::commands::WholeStreamCommand;
|
||||
// use crate::data::{Dictionary, Value};
|
||||
use crate::errors::ShellError;
|
||||
use crate::data::{Dictionary, Value};
|
||||
use crate::parser::registry::Signature;
|
||||
use crate::prelude::*;
|
||||
use indexmap::IndexMap;
|
||||
// use indexmap::IndexMap;
|
||||
|
||||
pub struct PWD;
|
||||
|
||||
@ -30,15 +30,7 @@ impl WholeStreamCommand for PWD {
|
||||
}
|
||||
|
||||
pub fn pwd(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream, ShellError> {
|
||||
let shell_manager = args.shell_manager.clone();
|
||||
let args = args.evaluate_once(registry)?;
|
||||
let span = args.call_info.name_span;
|
||||
|
||||
let mut indexmap = IndexMap::new();
|
||||
indexmap.insert(
|
||||
"name".to_string(),
|
||||
Tagged::from_simple_spanned_item(Value::string(std::env::current_dir()?.to_string_lossy()), span),
|
||||
);
|
||||
|
||||
let value = Tagged::from_simple_spanned_item(Value::Row(Dictionary::from(indexmap)), span);
|
||||
Ok(OutputStream::one(value))
|
||||
shell_manager.pwd(args)
|
||||
}
|
||||
|
Reference in New Issue
Block a user