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

@ -1,7 +1,9 @@
use inflector::cases::camelcase::to_camel_case;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value};
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate;
@ -14,11 +16,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("str camel-case").rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to camelCase by column paths",
)
Signature::build("str camel-case")
.rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to camelCase by column paths",
)
.category(Category::Strings)
}
fn usage(&self) -> &str {

View File

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

View File

@ -1,7 +1,9 @@
use inflector::cases::kebabcase::to_kebab_case;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value};
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate;
@ -14,11 +16,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("str kebab-case").rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to kebab-case by column paths",
)
Signature::build("str kebab-case")
.rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to kebab-case by column paths",
)
.category(Category::Strings)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use inflector::cases::pascalcase::to_pascal_case;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value};
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate;
@ -14,11 +16,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("str pascal-case").rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to PascalCase by column paths",
)
Signature::build("str pascal-case")
.rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to PascalCase by column paths",
)
.category(Category::Strings)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use inflector::cases::screamingsnakecase::to_screaming_snake_case;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value};
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate;
#[derive(Clone)]
@ -13,11 +15,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("str screaming-snake-case").rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to SCREAMING_SNAKE_CASE by column paths",
)
Signature::build("str screaming-snake-case")
.rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to SCREAMING_SNAKE_CASE by column paths",
)
.category(Category::Strings)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use inflector::cases::snakecase::to_snake_case;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value};
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate;
#[derive(Clone)]
@ -13,11 +15,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("str snake-case").rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to snake_case by column paths",
)
Signature::build("str snake-case")
.rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to snake_case by column paths",
)
.category(Category::Strings)
}
fn usage(&self) -> &str {
"converts a string to snake_case"