mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 03:08:24 +02:00
nu-cli: directory syntax shape + completions (#5299)
This commit is contained in:
@ -33,6 +33,7 @@ pub enum Expr {
|
||||
ValueWithUnit(Box<Expression>, Spanned<Unit>),
|
||||
DateTime(chrono::DateTime<FixedOffset>),
|
||||
Filepath(String),
|
||||
Directory(String),
|
||||
GlobPattern(String),
|
||||
String(String),
|
||||
CellPath(CellPath),
|
||||
|
@ -162,6 +162,7 @@ impl Expression {
|
||||
}
|
||||
Expr::ImportPattern(_) => false,
|
||||
Expr::Filepath(_) => false,
|
||||
Expr::Directory(_) => false,
|
||||
Expr::Float(_) => false,
|
||||
Expr::FullCellPath(full_cell_path) => {
|
||||
if full_cell_path.head.has_in_variable(working_set) {
|
||||
@ -320,6 +321,7 @@ impl Expression {
|
||||
}
|
||||
}
|
||||
Expr::Filepath(_) => {}
|
||||
Expr::Directory(_) => {}
|
||||
Expr::Float(_) => {}
|
||||
Expr::FullCellPath(full_cell_path) => {
|
||||
full_cell_path
|
||||
@ -467,6 +469,7 @@ impl Expression {
|
||||
}
|
||||
}
|
||||
Expr::Filepath(_) => {}
|
||||
Expr::Directory(_) => {}
|
||||
Expr::Float(_) => {}
|
||||
Expr::FullCellPath(full_cell_path) => {
|
||||
full_cell_path
|
||||
|
@ -34,6 +34,9 @@ pub enum SyntaxShape {
|
||||
/// A filepath is allowed
|
||||
Filepath,
|
||||
|
||||
/// A directory is allowed
|
||||
Directory,
|
||||
|
||||
/// A glob pattern is allowed, eg `foo*`
|
||||
GlobPattern,
|
||||
|
||||
@ -105,6 +108,7 @@ impl SyntaxShape {
|
||||
SyntaxShape::Duration => Type::Duration,
|
||||
SyntaxShape::Expression => Type::Any,
|
||||
SyntaxShape::Filepath => Type::String,
|
||||
SyntaxShape::Directory => Type::String,
|
||||
SyntaxShape::Filesize => Type::Filesize,
|
||||
SyntaxShape::FullCellPath => Type::Any,
|
||||
SyntaxShape::GlobPattern => Type::String,
|
||||
@ -145,6 +149,7 @@ impl Display for SyntaxShape {
|
||||
SyntaxShape::Range => write!(f, "range"),
|
||||
SyntaxShape::Int => write!(f, "int"),
|
||||
SyntaxShape::Filepath => write!(f, "path"),
|
||||
SyntaxShape::Directory => write!(f, "directory"),
|
||||
SyntaxShape::GlobPattern => write!(f, "glob"),
|
||||
SyntaxShape::ImportPattern => write!(f, "import"),
|
||||
SyntaxShape::Block(_) => write!(f, "block"),
|
||||
|
Reference in New Issue
Block a user