mirror of
https://github.com/nushell/nushell.git
synced 2025-08-11 14:54:51 +02:00
Add more input/output type annotations (#7532)
This commit is contained in:
committed by
GitHub
parent
d27263af97
commit
4e1f94026c
@ -2,7 +2,9 @@ use super::{get_current_shell, get_shells};
|
||||
use nu_engine::{current_dir, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Value};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
@ -15,6 +17,7 @@ impl Command for Enter {
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("enter")
|
||||
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
|
||||
.required(
|
||||
"path",
|
||||
SyntaxShape::Filepath,
|
||||
|
@ -2,7 +2,9 @@ use super::{get_current_shell, get_last_shell, get_shells};
|
||||
use nu_engine::{current_dir, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Value};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Exit;
|
||||
@ -14,6 +16,7 @@ impl Command for Exit {
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("exit")
|
||||
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
|
||||
.optional(
|
||||
"exit_code",
|
||||
SyntaxShape::Int,
|
||||
|
@ -2,7 +2,9 @@ use super::{list_shells, switch_shell, SwitchTo};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type,
|
||||
};
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
@ -15,6 +17,10 @@ impl Command for GotoShell {
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("g")
|
||||
.input_output_types(vec![
|
||||
(Type::Nothing, Type::Nothing),
|
||||
(Type::Nothing, Type::Table(vec![])),
|
||||
])
|
||||
.optional(
|
||||
"shell_number",
|
||||
SyntaxShape::String,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::{switch_shell, SwitchTo};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Type};
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
@ -13,7 +13,9 @@ impl Command for NextShell {
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("n").category(Category::Shells)
|
||||
Signature::build("n")
|
||||
.category(Category::Shells)
|
||||
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::{switch_shell, SwitchTo};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Type};
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
@ -13,7 +13,9 @@ impl Command for PrevShell {
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("p").category(Category::Shells)
|
||||
Signature::build("p")
|
||||
.category(Category::Shells)
|
||||
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::list_shells;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Type};
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
@ -13,7 +13,9 @@ impl Command for Shells {
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("shells").category(Category::Shells)
|
||||
Signature::build("shells")
|
||||
.category(Category::Shells)
|
||||
.input_output_types(vec![(Type::Nothing, Type::Table(vec![]))])
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
|
Reference in New Issue
Block a user