Add descriptions to arguments

This commit is contained in:
Jonathan Turner
2019-10-28 18:15:35 +13:00
parent 7d383421c6
commit fbd980f8b0
48 changed files with 308 additions and 121 deletions

View File

@ -53,10 +53,13 @@ impl Add {
impl Plugin for Add {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("add")
.desc("Add a new field to the table.")
.required("Field", SyntaxShape::ColumnPath)
.required("Value", SyntaxShape::String)
.rest(SyntaxShape::String)
.desc("Add a new column to the table.")
.required("column", SyntaxShape::ColumnPath, "the column name to add")
.required(
"value",
SyntaxShape::String,
"the value to give the cell(s)",
)
.filter())
}

View File

@ -16,7 +16,7 @@ impl Plugin for BinaryView {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("binaryview")
.desc("Autoview of binary data.")
.switch("lores"))
.switch("lores", "use low resolution output mode"))
}
fn sink(&mut self, call_info: CallInfo, input: Vec<Tagged<Value>>) {

View File

@ -48,8 +48,16 @@ impl Plugin for Edit {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("edit")
.desc("Edit an existing column to have a new value.")
.required("Field", SyntaxShape::ColumnPath)
.required("Value", SyntaxShape::String)
.required(
"Field",
SyntaxShape::ColumnPath,
"the name of the column to edit",
)
.required(
"Value",
SyntaxShape::String,
"the new value to give the cell(s)",
)
.filter())
}

View File

@ -28,7 +28,7 @@ impl Plugin for Embed {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("embed")
.desc("Embeds a new field to the table.")
.optional("field", SyntaxShape::String)
.optional("field", SyntaxShape::String, "the name of the new column")
.filter())
}

View File

@ -137,10 +137,10 @@ impl Plugin for Inc {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("inc")
.desc("Increment a value or version. Optionally use the column of a table.")
.switch("major")
.switch("minor")
.switch("patch")
.rest(SyntaxShape::ColumnPath)
.switch("major", "increment the major version (eg 1.2.1 -> 2.0.0)")
.switch("minor", "increment the minor version (eg 1.2.1 -> 1.3.0)")
.switch("patch", "increment the patch version (eg 1.2.1 -> 1.2.2)")
.rest(SyntaxShape::ColumnPath, "the column(s) to update")
.filter())
}

View File

@ -22,8 +22,8 @@ impl Plugin for Match {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("match")
.desc("filter rows by regex")
.required("member", SyntaxShape::Member)
.required("regex", SyntaxShape::String)
.required("member", SyntaxShape::Member, "the column name to match")
.required("regex", SyntaxShape::String, "the regex to match with")
.filter())
}
fn begin_filter(&mut self, call_info: CallInfo) -> Result<Vec<ReturnValue>, ShellError> {

View File

@ -17,7 +17,7 @@ impl Plugin for Skip {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("skip")
.desc("Skip a number of rows")
.rest(SyntaxShape::Number)
.rest(SyntaxShape::Number, "the number of rows to skip")
.filter())
}
fn begin_filter(&mut self, call_info: CallInfo) -> Result<Vec<ReturnValue>, ShellError> {

View File

@ -128,11 +128,11 @@ impl Str {
impl Plugin for Str {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("str")
.desc("Apply string function. Optional use the field of a table")
.switch("downcase")
.switch("upcase")
.switch("to-int")
.rest(SyntaxShape::ColumnPath)
.desc("Apply string function. Optional use the column of a table")
.switch("downcase", "convert string to lowercase")
.switch("upcase", "convert string to uppercase")
.switch("to-int", "convert string to integer")
.rest(SyntaxShape::ColumnPath, "the column(s) to convert")
.filter())
}