mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00:00
Move to a standard kebab/snake style (#4509)
This commit is contained in:
parent
d50ccdf083
commit
f5f9d56c37
25 changed files with 56 additions and 56 deletions
|
@ -16,7 +16,7 @@ impl Command for ErrorMake {
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("error make")
|
Signature::build("error make")
|
||||||
.optional("error-struct", SyntaxShape::Record, "the error to create")
|
.optional("error_struct", SyntaxShape::Record, "the error to create")
|
||||||
.category(Category::Core)
|
.category(Category::Core)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ impl Command for Aggregate {
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build(self.name())
|
Signature::build(self.name())
|
||||||
.required(
|
.required(
|
||||||
"operation-name",
|
"operation_name",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"\n\tDataframes: mean, sum, min, max, quantile, median, var, std
|
"\n\tDataframes: mean, sum, min, max, quantile, median, var, std
|
||||||
\tGroupBy: mean, sum, min, max, first, last, nunique, quantile, median, var, std, count",
|
\tGroupBy: mean, sum, min, max, first, last, nunique, quantile, median, var, std, count",
|
||||||
|
|
|
@ -157,9 +157,9 @@ fn from_csv(
|
||||||
) -> Result<polars::prelude::DataFrame, ShellError> {
|
) -> Result<polars::prelude::DataFrame, ShellError> {
|
||||||
let file: Spanned<PathBuf> = call.req(engine_state, stack, 0)?;
|
let file: Spanned<PathBuf> = call.req(engine_state, stack, 0)?;
|
||||||
let delimiter: Option<Spanned<String>> = call.get_flag(engine_state, stack, "delimiter")?;
|
let delimiter: Option<Spanned<String>> = call.get_flag(engine_state, stack, "delimiter")?;
|
||||||
let no_header: bool = call.has_flag("no_header");
|
let no_header: bool = call.has_flag("no-header");
|
||||||
let infer_schema: Option<usize> = call.get_flag(engine_state, stack, "infer_schema")?;
|
let infer_schema: Option<usize> = call.get_flag(engine_state, stack, "infer-schema")?;
|
||||||
let skip_rows: Option<usize> = call.get_flag(engine_state, stack, "skip_rows")?;
|
let skip_rows: Option<usize> = call.get_flag(engine_state, stack, "skip-rows")?;
|
||||||
let columns: Option<Vec<String>> = call.get_flag(engine_state, stack, "columns")?;
|
let columns: Option<Vec<String>> = call.get_flag(engine_state, stack, "columns")?;
|
||||||
|
|
||||||
let csv_reader = CsvReader::from_path(&file.item)
|
let csv_reader = CsvReader::from_path(&file.item)
|
||||||
|
|
|
@ -53,12 +53,12 @@ impl Command for PivotDF {
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build(self.name())
|
Signature::build(self.name())
|
||||||
.required(
|
.required(
|
||||||
"pivot-column",
|
"pivot_column",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"pivot column to perform pivot",
|
"pivot column to perform pivot",
|
||||||
)
|
)
|
||||||
.required(
|
.required(
|
||||||
"value-column",
|
"value_column",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"value column to perform pivot",
|
"value column to perform pivot",
|
||||||
)
|
)
|
||||||
|
|
|
@ -69,7 +69,7 @@ fn command(
|
||||||
) -> Result<PipelineData, ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let file_name: Spanned<PathBuf> = call.req(engine_state, stack, 0)?;
|
let file_name: Spanned<PathBuf> = call.req(engine_state, stack, 0)?;
|
||||||
let delimiter: Option<Spanned<String>> = call.get_flag(engine_state, stack, "delimiter")?;
|
let delimiter: Option<Spanned<String>> = call.get_flag(engine_state, stack, "delimiter")?;
|
||||||
let no_header: bool = call.has_flag("no_header");
|
let no_header: bool = call.has_flag("no-header");
|
||||||
|
|
||||||
let df = NuDataFrame::try_from_pipeline(input, call.head)?;
|
let df = NuDataFrame::try_from_pipeline(input, call.head)?;
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,8 @@ impl Command for ToHtml {
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("to html")
|
Signature::build("to html")
|
||||||
.switch("html_color", "change ansi colors to html colors", Some('c'))
|
.switch("html-color", "change ansi colors to html colors", Some('c'))
|
||||||
.switch("no_color", "remove all ansi colors in output", Some('n'))
|
.switch("no-color", "remove all ansi colors in output", Some('n'))
|
||||||
.switch(
|
.switch(
|
||||||
"dark",
|
"dark",
|
||||||
"indicate your background color is a darker color",
|
"indicate your background color is a darker color",
|
||||||
|
@ -289,8 +289,8 @@ fn to_html(
|
||||||
stack: &mut Stack,
|
stack: &mut Stack,
|
||||||
) -> Result<PipelineData, ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let head = call.head;
|
let head = call.head;
|
||||||
let html_color = call.has_flag("html_color");
|
let html_color = call.has_flag("html-color");
|
||||||
let no_color = call.has_flag("no_color");
|
let no_color = call.has_flag("no-color");
|
||||||
let dark = call.has_flag("dark");
|
let dark = call.has_flag("dark");
|
||||||
let partial = call.has_flag("partial");
|
let partial = call.has_flag("partial");
|
||||||
let list = call.has_flag("list");
|
let list = call.has_flag("list");
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl Command for Base64 {
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("hash base64")
|
Signature::build("hash base64")
|
||||||
.named(
|
.named(
|
||||||
"character_set",
|
"character-set",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"specify the character rules for encoding the input.\n\
|
"specify the character rules for encoding the input.\n\
|
||||||
\tValid values are 'standard', 'standard-no-padding', 'url-safe', 'url-safe-no-padding',\
|
\tValid values are 'standard', 'standard-no-padding', 'url-safe', 'url-safe-no-padding',\
|
||||||
|
@ -98,7 +98,7 @@ fn operate(
|
||||||
let encode = call.has_flag("encode");
|
let encode = call.has_flag("encode");
|
||||||
let decode = call.has_flag("decode");
|
let decode = call.has_flag("decode");
|
||||||
let character_set: Option<Spanned<String>> =
|
let character_set: Option<Spanned<String>> =
|
||||||
call.get_flag(engine_state, stack, "character_set")?;
|
call.get_flag(engine_state, stack, "character-set")?;
|
||||||
let column_paths: Vec<CellPath> = call.rest(engine_state, stack, 0)?;
|
let column_paths: Vec<CellPath> = call.rest(engine_state, stack, 0)?;
|
||||||
|
|
||||||
if encode && decode {
|
if encode && decode {
|
||||||
|
|
|
@ -90,7 +90,7 @@ impl Command for Du {
|
||||||
max_depth: call
|
max_depth: call
|
||||||
.get_flag::<i64>(engine_state, stack, "max-depth")?
|
.get_flag::<i64>(engine_state, stack, "max-depth")?
|
||||||
.map(|n| (n as u64).try_into().expect("error converting i64 to u64")),
|
.map(|n| (n as u64).try_into().expect("error converting i64 to u64")),
|
||||||
min_size: call.get_flag(engine_state, stack, "min_size")?,
|
min_size: call.get_flag(engine_state, stack, "min-size")?,
|
||||||
};
|
};
|
||||||
|
|
||||||
let exclude = args.exclude.map_or(Ok(None), move |x| {
|
let exclude = args.exclude.map_or(Ok(None), move |x| {
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl Command for Exit {
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("exit")
|
Signature::build("exit")
|
||||||
.optional(
|
.optional(
|
||||||
"exit-code",
|
"exit_code",
|
||||||
SyntaxShape::Int,
|
SyntaxShape::Int,
|
||||||
"Exit code to return immediately with",
|
"Exit code to return immediately with",
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl Command for GotoShell {
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("g")
|
Signature::build("g")
|
||||||
.required(
|
.required(
|
||||||
"shell-number",
|
"shell_number",
|
||||||
SyntaxShape::Int,
|
SyntaxShape::Int,
|
||||||
"shell number to change to",
|
"shell number to change to",
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl Command for DetectColumns {
|
||||||
"number of rows to skip before detecting",
|
"number of rows to skip before detecting",
|
||||||
Some('s'),
|
Some('s'),
|
||||||
)
|
)
|
||||||
.switch("no_headers", "don't detect headers", Some('n'))
|
.switch("no-headers", "don't detect headers", Some('n'))
|
||||||
.category(Category::Strings)
|
.category(Category::Strings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ fn detect_columns(
|
||||||
) -> Result<PipelineData, ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let name_span = call.head;
|
let name_span = call.head;
|
||||||
let num_rows_to_skip: Option<usize> = call.get_flag(engine_state, stack, "skip")?;
|
let num_rows_to_skip: Option<usize> = call.get_flag(engine_state, stack, "skip")?;
|
||||||
let noheader = call.has_flag("no_headers");
|
let noheader = call.has_flag("no-headers");
|
||||||
let ctrlc = engine_state.ctrlc.clone();
|
let ctrlc = engine_state.ctrlc.clone();
|
||||||
let config = stack.get_config()?;
|
let config = stack.get_config()?;
|
||||||
let input = input.collect_string("", &config)?;
|
let input = input.collect_string("", &config)?;
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub struct External;
|
||||||
|
|
||||||
impl Command for External {
|
impl Command for External {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"run_external"
|
"run-external"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
|
@ -35,8 +35,8 @@ impl Command for External {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> nu_protocol::Signature {
|
fn signature(&self) -> nu_protocol::Signature {
|
||||||
Signature::build("run_external")
|
Signature::build("run-external")
|
||||||
.switch("last_expression", "last_expression", None)
|
.switch("last-expression", "last-expression", None)
|
||||||
.rest("rest", SyntaxShape::Any, "external command to run")
|
.rest("rest", SyntaxShape::Any, "external command to run")
|
||||||
.category(Category::System)
|
.category(Category::System)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ impl Command for External {
|
||||||
) -> Result<PipelineData, ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let name: Spanned<String> = call.req(engine_state, stack, 0)?;
|
let name: Spanned<String> = call.req(engine_state, stack, 0)?;
|
||||||
let args: Vec<Value> = call.rest(engine_state, stack, 1)?;
|
let args: Vec<Value> = call.rest(engine_state, stack, 1)?;
|
||||||
let last_expression = call.has_flag("last_expression");
|
let last_expression = call.has_flag("last-expression");
|
||||||
|
|
||||||
// Translate environment variables from Values to Strings
|
// Translate environment variables from Values to Strings
|
||||||
let config = stack.get_config().unwrap_or_default();
|
let config = stack.get_config().unwrap_or_default();
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl Command for Table {
|
||||||
fn signature(&self) -> nu_protocol::Signature {
|
fn signature(&self) -> nu_protocol::Signature {
|
||||||
Signature::build("table")
|
Signature::build("table")
|
||||||
.named(
|
.named(
|
||||||
"start_number",
|
"start-number",
|
||||||
SyntaxShape::Int,
|
SyntaxShape::Int,
|
||||||
"row number to start viewing from",
|
"row number to start viewing from",
|
||||||
Some('n'),
|
Some('n'),
|
||||||
|
@ -52,7 +52,7 @@ impl Command for Table {
|
||||||
let ctrlc = engine_state.ctrlc.clone();
|
let ctrlc = engine_state.ctrlc.clone();
|
||||||
let config = stack.get_config().unwrap_or_default();
|
let config = stack.get_config().unwrap_or_default();
|
||||||
let color_hm = get_color_config(&config);
|
let color_hm = get_color_config(&config);
|
||||||
let start_num: Option<i64> = call.get_flag(engine_state, stack, "start_number")?;
|
let start_num: Option<i64> = call.get_flag(engine_state, stack, "start-number")?;
|
||||||
let row_offset = start_num.unwrap_or_default() as usize;
|
let row_offset = start_num.unwrap_or_default() as usize;
|
||||||
|
|
||||||
let term_width = if let Some((Width(w), Height(_h))) = terminal_size::terminal_size() {
|
let term_width = if let Some((Width(w), Height(_h))) = terminal_size::terminal_size() {
|
||||||
|
|
|
@ -18,7 +18,7 @@ fn base64_encode_characterset_binhex() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: ".", pipeline(
|
cwd: ".", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo 'username:password' | hash base64 --character_set binhex --encode
|
echo 'username:password' | hash base64 --character-set binhex --encode
|
||||||
"#
|
"#
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -63,7 +63,7 @@ fn error_invalid_decode_value() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: ".", pipeline(
|
cwd: ".", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "this should not be a valid encoded value" | hash base64 --character_set url-safe --decode
|
echo "this should not be a valid encoded value" | hash base64 --character-set url-safe --decode
|
||||||
"#
|
"#
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -50,7 +50,7 @@ fn test_cd_html_color_flag_dark_false() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: ".", pipeline(
|
cwd: ".", pipeline(
|
||||||
r#"
|
r#"
|
||||||
cd --help | to html --html_color
|
cd --help | to html --html-color
|
||||||
"#
|
"#
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -65,7 +65,7 @@ fn test_no_color_flag() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: ".", pipeline(
|
cwd: ".", pipeline(
|
||||||
r#"
|
r#"
|
||||||
cd --help | to html --no_color
|
cd --help | to html --no-color
|
||||||
"#
|
"#
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -80,7 +80,7 @@ fn test_html_color_where_flag_dark_false() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: ".", pipeline(
|
cwd: ".", pipeline(
|
||||||
r#"
|
r#"
|
||||||
where --help | to html --html_color
|
where --help | to html --html-color
|
||||||
"#
|
"#
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -172,7 +172,7 @@ fn eval_external(
|
||||||
last_expression: bool,
|
last_expression: bool,
|
||||||
) -> Result<PipelineData, ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let decl_id = engine_state
|
let decl_id = engine_state
|
||||||
.find_decl("run_external".as_bytes())
|
.find_decl("run-external".as_bytes())
|
||||||
.ok_or(ShellError::ExternalNotSupported(head.span))?;
|
.ok_or(ShellError::ExternalNotSupported(head.span))?;
|
||||||
|
|
||||||
let command = engine_state.get_decl(decl_id);
|
let command = engine_state.get_decl(decl_id);
|
||||||
|
@ -188,7 +188,7 @@ fn eval_external(
|
||||||
if last_expression {
|
if last_expression {
|
||||||
call.named.push((
|
call.named.push((
|
||||||
Spanned {
|
Spanned {
|
||||||
item: "last_expression".into(),
|
item: "last-expression".into(),
|
||||||
span: head.span,
|
span: head.span,
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl Command for KnownExternal {
|
||||||
match external_call.expr {
|
match external_call.expr {
|
||||||
Expr::ExternalCall(head, args) => {
|
Expr::ExternalCall(head, args) => {
|
||||||
let decl_id = engine_state
|
let decl_id = engine_state
|
||||||
.find_decl("run_external".as_bytes())
|
.find_decl("run-external".as_bytes())
|
||||||
.ok_or(ShellError::ExternalNotSupported(head.span))?;
|
.ok_or(ShellError::ExternalNotSupported(head.span))?;
|
||||||
|
|
||||||
let command = engine_state.get_decl(decl_id);
|
let command = engine_state.get_decl(decl_id);
|
||||||
|
@ -64,7 +64,7 @@ impl Command for KnownExternal {
|
||||||
// if last_expression {
|
// if last_expression {
|
||||||
// call.named.push((
|
// call.named.push((
|
||||||
// Spanned {
|
// Spanned {
|
||||||
// item: "last_expression".into(),
|
// item: "last-expression".into(),
|
||||||
// span: head.span,
|
// span: head.span,
|
||||||
// },
|
// },
|
||||||
// None,
|
// None,
|
||||||
|
|
|
@ -297,9 +297,9 @@ mod tests {
|
||||||
let signature = Signature::build("nu-plugin")
|
let signature = Signature::build("nu-plugin")
|
||||||
.required("first", SyntaxShape::String, "first required")
|
.required("first", SyntaxShape::String, "first required")
|
||||||
.required("second", SyntaxShape::Int, "second required")
|
.required("second", SyntaxShape::Int, "second required")
|
||||||
.required_named("first_named", SyntaxShape::String, "first named", Some('f'))
|
.required_named("first-named", SyntaxShape::String, "first named", Some('f'))
|
||||||
.required_named(
|
.required_named(
|
||||||
"second_named",
|
"second-named",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"second named",
|
"second named",
|
||||||
Some('s'),
|
Some('s'),
|
||||||
|
|
|
@ -301,8 +301,8 @@ mod tests {
|
||||||
let signature = Signature::build("nu-plugin")
|
let signature = Signature::build("nu-plugin")
|
||||||
.required("first", SyntaxShape::String, "first required")
|
.required("first", SyntaxShape::String, "first required")
|
||||||
.required("second", SyntaxShape::Int, "second required")
|
.required("second", SyntaxShape::Int, "second required")
|
||||||
.required_named("first_named", SyntaxShape::String, "first named", Some('f'))
|
.required_named("first-named", SyntaxShape::String, "first named", Some('f'))
|
||||||
.required_named("second_named", SyntaxShape::Int, "first named", Some('s'))
|
.required_named("second-named", SyntaxShape::Int, "first named", Some('s'))
|
||||||
.required_named("name", SyntaxShape::String, "first named", Some('n'))
|
.required_named("name", SyntaxShape::String, "first named", Some('n'))
|
||||||
.required_named("string", SyntaxShape::String, "second named", Some('x'))
|
.required_named("string", SyntaxShape::String, "second named", Some('x'))
|
||||||
.switch("switch", "some switch", None)
|
.switch("switch", "some switch", None)
|
||||||
|
|
|
@ -149,9 +149,9 @@ mod tests {
|
||||||
let signature = Signature::build("nu-plugin")
|
let signature = Signature::build("nu-plugin")
|
||||||
.required("first", SyntaxShape::String, "first required")
|
.required("first", SyntaxShape::String, "first required")
|
||||||
.required("second", SyntaxShape::Int, "second required")
|
.required("second", SyntaxShape::Int, "second required")
|
||||||
.required_named("first_named", SyntaxShape::String, "first named", Some('f'))
|
.required_named("first-named", SyntaxShape::String, "first named", Some('f'))
|
||||||
.required_named(
|
.required_named(
|
||||||
"second_named",
|
"second-named",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"second named",
|
"second named",
|
||||||
Some('s'),
|
Some('s'),
|
||||||
|
|
|
@ -20,7 +20,7 @@ fn test_signature_chained() {
|
||||||
.required("required", SyntaxShape::String, "required description")
|
.required("required", SyntaxShape::String, "required description")
|
||||||
.optional("optional", SyntaxShape::String, "optional description")
|
.optional("optional", SyntaxShape::String, "optional description")
|
||||||
.required_named(
|
.required_named(
|
||||||
"req_named",
|
"req-named",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"required named description",
|
"required named description",
|
||||||
Some('r'),
|
Some('r'),
|
||||||
|
@ -36,7 +36,7 @@ fn test_signature_chained() {
|
||||||
assert_eq!(signature.get_shorts(), vec!['h', 'r', 'n']);
|
assert_eq!(signature.get_shorts(), vec!['h', 'r', 'n']);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
signature.get_names(),
|
signature.get_names(),
|
||||||
vec!["help", "req_named", "named", "switch"]
|
vec!["help", "req-named", "named", "switch"]
|
||||||
);
|
);
|
||||||
assert_eq!(signature.num_positionals(), 2);
|
assert_eq!(signature.num_positionals(), 2);
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ fn test_signature_chained() {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
signature.get_long_flag("req_named"),
|
signature.get_long_flag("req-named"),
|
||||||
Some(Flag {
|
Some(Flag {
|
||||||
long: "req_named".to_string(),
|
long: "req-named".to_string(),
|
||||||
short: Some('r'),
|
short: Some('r'),
|
||||||
arg: Some(SyntaxShape::String),
|
arg: Some(SyntaxShape::String),
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -83,7 +83,7 @@ fn test_signature_chained() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
signature.get_short_flag('r'),
|
signature.get_short_flag('r'),
|
||||||
Some(Flag {
|
Some(Flag {
|
||||||
long: "req_named".to_string(),
|
long: "req-named".to_string(),
|
||||||
short: Some('r'),
|
short: Some('r'),
|
||||||
arg: Some(SyntaxShape::String),
|
arg: Some(SyntaxShape::String),
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -99,7 +99,7 @@ fn test_signature_same_short() {
|
||||||
// Creating signature with same short name should panic
|
// Creating signature with same short name should panic
|
||||||
Signature::new("new_signature")
|
Signature::new("new_signature")
|
||||||
.required_named(
|
.required_named(
|
||||||
"required_named",
|
"required-named",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"required named description",
|
"required named description",
|
||||||
Some('n'),
|
Some('n'),
|
||||||
|
@ -111,7 +111,7 @@ fn test_signature_same_short() {
|
||||||
#[should_panic(expected = "There may be duplicate name flags, such as --help")]
|
#[should_panic(expected = "There may be duplicate name flags, such as --help")]
|
||||||
fn test_signature_same_name() {
|
fn test_signature_same_name() {
|
||||||
// Creating signature with same short name should panic
|
// Creating signature with same short name should panic
|
||||||
Signature::new("new_signature")
|
Signature::new("new-signature")
|
||||||
.required_named(
|
.required_named(
|
||||||
"name",
|
"name",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
|
@ -129,7 +129,7 @@ fn test_signature_round_trip() {
|
||||||
.required("second", SyntaxShape::Int, "second required")
|
.required("second", SyntaxShape::Int, "second required")
|
||||||
.optional("optional", SyntaxShape::String, "optional description")
|
.optional("optional", SyntaxShape::String, "optional description")
|
||||||
.required_named(
|
.required_named(
|
||||||
"req_named",
|
"req-named",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"required named description",
|
"required named description",
|
||||||
Some('r'),
|
Some('r'),
|
||||||
|
|
|
@ -22,7 +22,7 @@ impl Plugin for Query {
|
||||||
Signature::build("query web")
|
Signature::build("query web")
|
||||||
.desc("execute selector query on html/web")
|
.desc("execute selector query on html/web")
|
||||||
.named("query", SyntaxShape::String, "selector query", Some('q'))
|
.named("query", SyntaxShape::String, "selector query", Some('q'))
|
||||||
.switch("as_html", "return the query output as html", Some('m'))
|
.switch("as-html", "return the query output as html", Some('m'))
|
||||||
.named(
|
.named(
|
||||||
"attribute",
|
"attribute",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
|
@ -30,7 +30,7 @@ impl Plugin for Query {
|
||||||
Some('a'),
|
Some('a'),
|
||||||
)
|
)
|
||||||
.named(
|
.named(
|
||||||
"as_table",
|
"as-table",
|
||||||
SyntaxShape::Table,
|
SyntaxShape::Table,
|
||||||
"find table based on column header list",
|
"find table based on column header list",
|
||||||
Some('t'),
|
Some('t'),
|
||||||
|
|
|
@ -35,12 +35,12 @@ pub fn parse_selector_params(call: &EvaluatedCall, input: &Value) -> Result<Valu
|
||||||
Some(q2) => q2,
|
Some(q2) => q2,
|
||||||
None => "".to_string(),
|
None => "".to_string(),
|
||||||
};
|
};
|
||||||
let as_html = call.has_flag("as_html");
|
let as_html = call.has_flag("as-html");
|
||||||
let attribute: String = match call.get_flag("attribute")? {
|
let attribute: String = match call.get_flag("attribute")? {
|
||||||
Some(a) => a,
|
Some(a) => a,
|
||||||
None => "".to_string(),
|
None => "".to_string(),
|
||||||
};
|
};
|
||||||
let as_table: Value = match call.get_flag("as_table")? {
|
let as_table: Value = match call.get_flag("as-table")? {
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
None => Value::nothing(head),
|
None => Value::nothing(head),
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,7 +52,7 @@ impl Handler {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(access_key) = call_info.args.get("access_key") {
|
if let Some(access_key) = call_info.args.get("access-key") {
|
||||||
self.config.access_key = access_key.as_string()?
|
self.config.access_key = access_key.as_string()?
|
||||||
} else {
|
} else {
|
||||||
return Err(ShellError::labeled_error(
|
return Err(ShellError::labeled_error(
|
||||||
|
@ -62,7 +62,7 @@ impl Handler {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(secret_key) = call_info.args.get("secret_key") {
|
if let Some(secret_key) = call_info.args.get("secret-key") {
|
||||||
self.config.secret_key = secret_key.as_string()?
|
self.config.secret_key = secret_key.as_string()?
|
||||||
} else {
|
} else {
|
||||||
return Err(ShellError::labeled_error(
|
return Err(ShellError::labeled_error(
|
||||||
|
|
|
@ -22,13 +22,13 @@ impl Plugin for handler::Handler {
|
||||||
Some('e'),
|
Some('e'),
|
||||||
)
|
)
|
||||||
.named(
|
.named(
|
||||||
"access_key",
|
"access-key",
|
||||||
SyntaxShape::Any,
|
SyntaxShape::Any,
|
||||||
"the access key when authenticating",
|
"the access key when authenticating",
|
||||||
Some('a'),
|
Some('a'),
|
||||||
)
|
)
|
||||||
.named(
|
.named(
|
||||||
"secret_key",
|
"secret-key",
|
||||||
SyntaxShape::Any,
|
SyntaxShape::Any,
|
||||||
"the secret key when authenticating",
|
"the secret key when authenticating",
|
||||||
Some('s'),
|
Some('s'),
|
||||||
|
|
Loading…
Reference in a new issue