mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 09:35:44 +02:00
Add path completions
This commit is contained in:
@ -15,7 +15,7 @@ impl Command for Cd {
|
||||
}
|
||||
|
||||
fn signature(&self) -> nu_protocol::Signature {
|
||||
Signature::build("cd").optional("path", SyntaxShape::FilePath, "the path to change to")
|
||||
Signature::build("cd").optional("path", SyntaxShape::Filepath, "the path to change to")
|
||||
}
|
||||
|
||||
fn run(
|
||||
|
@ -31,7 +31,14 @@ impl Command for Ls {
|
||||
) -> Result<nu_protocol::Value, nu_protocol::ShellError> {
|
||||
let pattern = if let Some(expr) = call.positional.get(0) {
|
||||
let result = eval_expression(context, expr)?;
|
||||
result.as_string()?
|
||||
let mut result = result.as_string()?;
|
||||
|
||||
let path = std::path::Path::new(&result);
|
||||
if path.is_dir() {
|
||||
result.push('*');
|
||||
}
|
||||
|
||||
result
|
||||
} else {
|
||||
"*".into()
|
||||
};
|
||||
|
Reference in New Issue
Block a user