Category option for signature (#343)

* category option for signature

* category option for signature

* column description for $scope
This commit is contained in:
Fernando Herrera
2021-11-17 04:22:37 +00:00
committed by GitHub
parent 6fbe02eb21
commit b35914bd17
118 changed files with 739 additions and 335 deletions

View File

@ -2,7 +2,7 @@ use nu_engine::get_full_help;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
IntoPipelineData, PipelineData, ShellError, Signature, Value,
Category, IntoPipelineData, PipelineData, ShellError, Signature, Value,
};
#[derive(Clone)]
@ -14,7 +14,7 @@ impl Command for Date {
}
fn signature(&self) -> Signature {
Signature::build("date")
Signature::build("date").category(Category::Date)
}
fn usage(&self) -> &str {

View File

@ -3,7 +3,7 @@ use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Example, PipelineData, Signature, Span, Spanned, SyntaxShape, Value,
Category, Example, PipelineData, Signature, Span, Spanned, SyntaxShape, Value,
};
use super::utils::{parse_date_from_string, unsupported_input_error};
@ -17,11 +17,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("date format").required(
"format string",
SyntaxShape::String,
"the desired date format",
)
Signature::build("date format")
.required(
"format string",
SyntaxShape::String,
"the desired date format",
)
.category(Category::Date)
}
fn usage(&self) -> &str {

View File

@ -3,7 +3,7 @@ use chrono::{DateTime, FixedOffset, Local};
use chrono_humanize::HumanTime;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value};
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)]
pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("date humanize")
Signature::build("date humanize").category(Category::Date)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use chrono_tz::TZ_VARIANTS;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoInterruptiblePipelineData, PipelineData, Signature, Value};
use nu_protocol::{Category, IntoInterruptiblePipelineData, PipelineData, Signature, Value};
#[derive(Clone)]
pub struct SubCommand;
@ -12,7 +12,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("date list-timezone")
Signature::build("date list-timezone").category(Category::Date)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use chrono::Local;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoPipelineData, PipelineData, Signature, Value};
use nu_protocol::{Category, IntoPipelineData, PipelineData, Signature, Value};
#[derive(Clone)]
pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("date now")
Signature::build("date now").category(Category::Date)
}
fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use crate::date::utils::{parse_date_from_string, unsupported_input_error};
use chrono::{DateTime, Datelike, FixedOffset, Local, Timelike};
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, Signature, Span, Value};
use nu_protocol::{Category, Example, PipelineData, Signature, Span, Value};
#[derive(Clone)]
pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("date to-table")
Signature::build("date to-table").category(Category::Date)
}
fn usage(&self) -> &str {

View File

@ -5,7 +5,7 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value,
Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value,
};
use chrono::{FixedOffset, TimeZone};
@ -19,11 +19,9 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("date to-timezone").required(
"time zone",
SyntaxShape::String,
"time zone description",
)
Signature::build("date to-timezone")
.required("time zone", SyntaxShape::String, "time zone description")
.category(Category::Date)
}
fn usage(&self) -> &str {