mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 06:30:08 +02:00
contents declaration
This commit is contained in:
@ -67,6 +67,8 @@ pub fn create_default_context() -> Rc<RefCell<EngineState>> {
|
||||
working_set.add_decl(sig.predeclare());
|
||||
let sig = Signature::build("stack");
|
||||
working_set.add_decl(sig.predeclare());
|
||||
let sig = Signature::build("contents");
|
||||
working_set.add_decl(sig.predeclare());
|
||||
|
||||
working_set.render()
|
||||
};
|
||||
|
@ -113,6 +113,11 @@ impl EngineState {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_contents(&self) {
|
||||
let string = String::from_utf8_lossy(&self.file_contents);
|
||||
println!("{}", string);
|
||||
}
|
||||
|
||||
pub fn find_decl(&self, name: &[u8]) -> Option<DeclId> {
|
||||
for scope in self.scope.iter().rev() {
|
||||
if let Some(decl_id) = scope.decls.get(name) {
|
||||
|
Reference in New Issue
Block a user