mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 04:38:15 +02:00
Split blocks and closures (#7075)
* Split closures and blocks * Tests mostly working * finish last fixes, passes all tests * fmt
This commit is contained in:
@ -6,7 +6,7 @@ use std::time::Duration;
|
||||
use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
|
||||
use nu_engine::{current_dir, eval_block, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{CaptureBlock, Command, EngineState, Stack, StateWorkingSet};
|
||||
use nu_protocol::engine::{Closure, Command, EngineState, Stack, StateWorkingSet};
|
||||
use nu_protocol::{
|
||||
format_error, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature,
|
||||
Spanned, SyntaxShape, Value,
|
||||
@ -35,7 +35,7 @@ impl Command for Watch {
|
||||
fn signature(&self) -> nu_protocol::Signature {
|
||||
Signature::build("watch")
|
||||
.required("path", SyntaxShape::Filepath, "the path to watch. Can be a file or directory")
|
||||
.required("block", SyntaxShape::Block(None), "A Nu block of code to run whenever a file changes. The block will be passed `operation`, `path`, and `new_path` (for renames only) arguments in that order")
|
||||
.required("block", SyntaxShape::Block, "A Nu block of code to run whenever a file changes. The block will be passed `operation`, `path`, and `new_path` (for renames only) arguments in that order")
|
||||
.named(
|
||||
"debounce-ms",
|
||||
SyntaxShape::Int,
|
||||
@ -82,7 +82,7 @@ impl Command for Watch {
|
||||
}
|
||||
};
|
||||
|
||||
let capture_block: CaptureBlock = call.req(engine_state, stack, 1)?;
|
||||
let capture_block: Closure = call.req(engine_state, stack, 1)?;
|
||||
let block = engine_state
|
||||
.clone()
|
||||
.get_block(capture_block.block_id)
|
||||
|
Reference in New Issue
Block a user