Add a very silly ls
This commit is contained in:
parent
5edcf3910d
commit
16baf5e16a
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -164,6 +164,12 @@ dependencies = [
|
||||||
"wasi",
|
"wasi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glob"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "instant"
|
name = "instant"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
|
@ -276,6 +282,7 @@ dependencies = [
|
||||||
name = "nu-command"
|
name = "nu-command"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"glob",
|
||||||
"nu-engine",
|
"nu-engine",
|
||||||
"nu-protocol",
|
"nu-protocol",
|
||||||
]
|
]
|
||||||
|
|
|
@ -7,4 +7,7 @@ edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-protocol = { path = "../nu-protocol" }
|
nu-protocol = { path = "../nu-protocol" }
|
||||||
nu-engine = { path = "../nu-engine" }
|
nu-engine = { path = "../nu-engine" }
|
||||||
|
|
||||||
|
# Potential dependencies for extras
|
||||||
|
glob = "0.3.0"
|
|
@ -6,7 +6,7 @@ use nu_protocol::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
where_::Where, Alias, Benchmark, BuildString, Def, Do, Each, For, If, Length, Let, LetEnv,
|
where_::Where, Alias, Benchmark, BuildString, Def, Do, Each, For, If, Length, Let, LetEnv, Ls,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn create_default_context() -> Rc<RefCell<EngineState>> {
|
pub fn create_default_context() -> Rc<RefCell<EngineState>> {
|
||||||
|
@ -43,6 +43,8 @@ pub fn create_default_context() -> Rc<RefCell<EngineState>> {
|
||||||
|
|
||||||
working_set.add_decl(Box::new(Length));
|
working_set.add_decl(Box::new(Length));
|
||||||
|
|
||||||
|
working_set.add_decl(Box::new(Ls));
|
||||||
|
|
||||||
let sig = Signature::build("exit");
|
let sig = Signature::build("exit");
|
||||||
working_set.add_decl(sig.predeclare());
|
working_set.add_decl(sig.predeclare());
|
||||||
let sig = Signature::build("vars");
|
let sig = Signature::build("vars");
|
||||||
|
|
|
@ -10,6 +10,7 @@ mod if_;
|
||||||
mod length;
|
mod length;
|
||||||
mod let_;
|
mod let_;
|
||||||
mod let_env;
|
mod let_env;
|
||||||
|
mod ls;
|
||||||
mod where_;
|
mod where_;
|
||||||
|
|
||||||
pub use alias::Alias;
|
pub use alias::Alias;
|
||||||
|
@ -24,3 +25,4 @@ pub use if_::If;
|
||||||
pub use length::Length;
|
pub use length::Length;
|
||||||
pub use let_::Let;
|
pub use let_::Let;
|
||||||
pub use let_env::LetEnv;
|
pub use let_env::LetEnv;
|
||||||
|
pub use ls::Ls;
|
||||||
|
|
|
@ -278,6 +278,13 @@ impl Value {
|
||||||
Ok(current)
|
Ok(current)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn string(s: &str, span: Span) -> Value {
|
||||||
|
Value::String {
|
||||||
|
val: s.into(),
|
||||||
|
span,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_true(&self) -> bool {
|
pub fn is_true(&self) -> bool {
|
||||||
matches!(self, Value::Bool { val: true, .. })
|
matches!(self, Value::Bool { val: true, .. })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user