nu-cli: directory syntax shape + completions (#5299)

This commit is contained in:
Herlon Aguiar
2022-04-22 22:18:51 +02:00
committed by GitHub
parent 661283c4d2
commit 5ff2ae628b
15 changed files with 211 additions and 9 deletions

View File

@ -17,7 +17,7 @@ impl Command for Cd {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("cd")
.optional("path", SyntaxShape::Filepath, "the path to change to")
.optional("path", SyntaxShape::Directory, "the path to change to")
.category(Category::FileSystem)
}

View File

@ -21,7 +21,7 @@ impl Command for Mkdir {
Signature::build("mkdir")
.rest(
"rest",
SyntaxShape::Filepath,
SyntaxShape::Directory,
"the name(s) of the path(s) to create",
)
.switch("show-created-paths", "show the path(s) created.", Some('s'))

View File

@ -237,6 +237,7 @@ fn convert_to_value(
expr.span,
)),
Expr::Filepath(val) => Ok(Value::String { val, span }),
Expr::Directory(val) => Ok(Value::String { val, span }),
Expr::Float(val) => Ok(Value::Float { val, span }),
Expr::FullCellPath(full_cell_path) => {
if !full_cell_path.tail.is_empty() {