mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 10:48:37 +02:00
Abbreviate ls by default, add --full flag
This commit is contained in:
@ -86,6 +86,7 @@ impl Shell for FilesystemShell {
|
||||
&self,
|
||||
pattern: Option<Tagged<PathBuf>>,
|
||||
context: &RunnableContext,
|
||||
full: bool,
|
||||
) -> Result<OutputStream, ShellError> {
|
||||
let cwd = self.path();
|
||||
let mut full_path = PathBuf::from(self.path());
|
||||
@ -136,7 +137,7 @@ impl Shell for FilesystemShell {
|
||||
Path::new(&filepath)
|
||||
};
|
||||
|
||||
let value = dir_entry_dict(filename, &metadata, &name_tag)?;
|
||||
let value = dir_entry_dict(filename, &metadata, &name_tag, full)?;
|
||||
yield ReturnSuccess::value(value);
|
||||
}
|
||||
}
|
||||
@ -175,7 +176,7 @@ impl Shell for FilesystemShell {
|
||||
Path::new(&entry)
|
||||
};
|
||||
|
||||
if let Ok(value) = dir_entry_dict(filename, &metadata, &name_tag) {
|
||||
if let Ok(value) = dir_entry_dict(filename, &metadata, &name_tag, full) {
|
||||
yield ReturnSuccess::value(value);
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +129,7 @@ impl Shell for HelpShell {
|
||||
&self,
|
||||
_pattern: Option<Tagged<PathBuf>>,
|
||||
_context: &RunnableContext,
|
||||
_full: bool,
|
||||
) -> Result<OutputStream, ShellError> {
|
||||
Ok(self
|
||||
.commands()
|
||||
|
@ -16,6 +16,7 @@ pub trait Shell: std::fmt::Debug {
|
||||
&self,
|
||||
pattern: Option<Tagged<PathBuf>>,
|
||||
context: &RunnableContext,
|
||||
full: bool,
|
||||
) -> Result<OutputStream, ShellError>;
|
||||
fn cd(&self, args: EvaluatedWholeStreamCommandArgs) -> Result<OutputStream, ShellError>;
|
||||
fn cp(&self, args: CopyArgs, name: Tag, path: &str) -> Result<OutputStream, ShellError>;
|
||||
|
@ -127,10 +127,11 @@ impl ShellManager {
|
||||
&self,
|
||||
path: Option<Tagged<PathBuf>>,
|
||||
context: &RunnableContext,
|
||||
full: bool,
|
||||
) -> Result<OutputStream, ShellError> {
|
||||
let env = self.shells.lock().unwrap();
|
||||
|
||||
env[self.current_shell()].ls(path, context)
|
||||
env[self.current_shell()].ls(path, context, full)
|
||||
}
|
||||
|
||||
pub fn cd(&self, args: EvaluatedWholeStreamCommandArgs) -> Result<OutputStream, ShellError> {
|
||||
|
@ -90,6 +90,7 @@ impl Shell for ValueShell {
|
||||
&self,
|
||||
target: Option<Tagged<PathBuf>>,
|
||||
context: &RunnableContext,
|
||||
_full: bool,
|
||||
) -> Result<OutputStream, ShellError> {
|
||||
let mut full_path = PathBuf::from(self.path());
|
||||
let name_tag = context.name.clone();
|
||||
|
Reference in New Issue
Block a user