Add more input/output type annotations (#7532)

This commit is contained in:
Stefan Holderbach
2022-12-21 20:20:46 +01:00
committed by GitHub
parent d27263af97
commit 4e1f94026c
78 changed files with 324 additions and 186 deletions

View File

@ -7,7 +7,7 @@ use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::RawStream;
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use reqwest::blocking::Response;
@ -29,6 +29,7 @@ impl Command for SubCommand {
fn signature(&self) -> Signature {
Signature::build("fetch")
.input_output_types(vec![(Type::Nothing, Type::Any)])
.required(
"URL",
SyntaxShape::String,

View File

@ -5,7 +5,7 @@ use nu_protocol::IntoPipelineData;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpListener};
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)]
@ -18,6 +18,7 @@ impl Command for SubCommand {
fn signature(&self) -> Signature {
Signature::build("port")
.input_output_types(vec![(Type::Nothing, Type::Int)])
.optional(
"start",
SyntaxShape::Int,

View File

@ -10,7 +10,7 @@ use std::path::PathBuf;
use std::str::FromStr;
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use std::collections::HashMap;
use std::io::BufReader;
@ -25,6 +25,7 @@ impl Command for SubCommand {
fn signature(&self) -> Signature {
Signature::build("post")
.input_output_types(vec![(Type::Nothing, Type::Any)])
.required("path", SyntaxShape::String, "the URL to post to")
.required("body", SyntaxShape::Any, "the contents of the post body")
.named(