This improves incremental build time when working on what was previously the root package. For example, previously all plugins would be rebuilt with a change to `src/commands/classified/external.rs`, but now only `nu-cli` will have to be rebuilt (and anything that depends on it).
46 lines
1.1 KiB
Rust
46 lines
1.1 KiB
Rust
use crate::commands::WholeStreamCommand;
|
|
use crate::prelude::*;
|
|
use nu_errors::ShellError;
|
|
use nu_macros::signature;
|
|
use nu_protocol::{Signature, SyntaxShape};
|
|
|
|
pub struct Cd;
|
|
|
|
impl WholeStreamCommand for Cd {
|
|
fn name(&self) -> &str {
|
|
"cd"
|
|
}
|
|
|
|
fn signature(&self) -> Signature {
|
|
signature! {
|
|
def cd {
|
|
"the directory to change to"
|
|
directory(optional Path) - "the directory to change to"
|
|
}
|
|
}
|
|
// Signature::build("cd").optional(
|
|
// "directory",
|
|
// SyntaxShape::Path,
|
|
// "the directory to change to",
|
|
// )
|
|
}
|
|
|
|
fn usage(&self) -> &str {
|
|
"Change to a new path."
|
|
}
|
|
|
|
fn run(
|
|
&self,
|
|
args: CommandArgs,
|
|
registry: &CommandRegistry,
|
|
) -> Result<OutputStream, ShellError> {
|
|
cd(args, registry)
|
|
}
|
|
}
|
|
|
|
fn cd(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream, ShellError> {
|
|
let shell_manager = args.shell_manager.clone();
|
|
let args = args.evaluate_once(registry)?;
|
|
shell_manager.cd(args)
|
|
}
|