Move to a standard kebab/snake style (#4509)

This commit is contained in:
JT
2022-02-17 09:55:17 -05:00
committed by GitHub
parent d50ccdf083
commit f5f9d56c37
25 changed files with 56 additions and 56 deletions

View File

@ -16,7 +16,7 @@ impl Command for ErrorMake {
fn signature(&self) -> Signature {
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)
}

View File

@ -123,7 +123,7 @@ impl Command for Aggregate {
fn signature(&self) -> Signature {
Signature::build(self.name())
.required(
"operation-name",
"operation_name",
SyntaxShape::String,
"\n\tDataframes: mean, sum, min, max, quantile, median, var, std
\tGroupBy: mean, sum, min, max, first, last, nunique, quantile, median, var, std, count",

View File

@ -157,9 +157,9 @@ fn from_csv(
) -> Result<polars::prelude::DataFrame, ShellError> {
let file: Spanned<PathBuf> = call.req(engine_state, stack, 0)?;
let delimiter: Option<Spanned<String>> = call.get_flag(engine_state, stack, "delimiter")?;
let no_header: bool = call.has_flag("no_header");
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 no_header: bool = call.has_flag("no-header");
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 columns: Option<Vec<String>> = call.get_flag(engine_state, stack, "columns")?;
let csv_reader = CsvReader::from_path(&file.item)

View File

@ -53,12 +53,12 @@ impl Command for PivotDF {
fn signature(&self) -> Signature {
Signature::build(self.name())
.required(
"pivot-column",
"pivot_column",
SyntaxShape::String,
"pivot column to perform pivot",
)
.required(
"value-column",
"value_column",
SyntaxShape::String,
"value column to perform pivot",
)

View File

@ -69,7 +69,7 @@ fn command(
) -> Result<PipelineData, ShellError> {
let file_name: Spanned<PathBuf> = call.req(engine_state, stack, 0)?;
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)?;

View File

@ -90,8 +90,8 @@ impl Command for ToHtml {
fn signature(&self) -> Signature {
Signature::build("to html")
.switch("html_color", "change ansi colors to html colors", Some('c'))
.switch("no_color", "remove all ansi colors in output", Some('n'))
.switch("html-color", "change ansi colors to html colors", Some('c'))
.switch("no-color", "remove all ansi colors in output", Some('n'))
.switch(
"dark",
"indicate your background color is a darker color",
@ -289,8 +289,8 @@ fn to_html(
stack: &mut Stack,
) -> Result<PipelineData, ShellError> {
let head = call.head;
let html_color = call.has_flag("html_color");
let no_color = call.has_flag("no_color");
let html_color = call.has_flag("html-color");
let no_color = call.has_flag("no-color");
let dark = call.has_flag("dark");
let partial = call.has_flag("partial");
let list = call.has_flag("list");

View File

@ -29,7 +29,7 @@ impl Command for Base64 {
fn signature(&self) -> Signature {
Signature::build("hash base64")
.named(
"character_set",
"character-set",
SyntaxShape::String,
"specify the character rules for encoding the input.\n\
\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 decode = call.has_flag("decode");
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)?;
if encode && decode {

View File

@ -90,7 +90,7 @@ impl Command for Du {
max_depth: call
.get_flag::<i64>(engine_state, stack, "max-depth")?
.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| {

View File

@ -15,7 +15,7 @@ impl Command for Exit {
fn signature(&self) -> Signature {
Signature::build("exit")
.optional(
"exit-code",
"exit_code",
SyntaxShape::Int,
"Exit code to return immediately with",
)

View File

@ -15,7 +15,7 @@ impl Command for GotoShell {
fn signature(&self) -> Signature {
Signature::build("g")
.required(
"shell-number",
"shell_number",
SyntaxShape::Int,
"shell number to change to",
)

View File

@ -27,7 +27,7 @@ impl Command for DetectColumns {
"number of rows to skip before detecting",
Some('s'),
)
.switch("no_headers", "don't detect headers", Some('n'))
.switch("no-headers", "don't detect headers", Some('n'))
.category(Category::Strings)
}
@ -54,7 +54,7 @@ fn detect_columns(
) -> Result<PipelineData, ShellError> {
let name_span = call.head;
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 config = stack.get_config()?;
let input = input.collect_string("", &config)?;

View File

@ -23,7 +23,7 @@ pub struct External;
impl Command for External {
fn name(&self) -> &str {
"run_external"
"run-external"
}
fn usage(&self) -> &str {
@ -35,8 +35,8 @@ impl Command for External {
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("run_external")
.switch("last_expression", "last_expression", None)
Signature::build("run-external")
.switch("last-expression", "last-expression", None)
.rest("rest", SyntaxShape::Any, "external command to run")
.category(Category::System)
}
@ -50,7 +50,7 @@ impl Command for External {
) -> Result<PipelineData, ShellError> {
let name: Spanned<String> = call.req(engine_state, stack, 0)?;
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
let config = stack.get_config().unwrap_or_default();

View File

@ -33,7 +33,7 @@ impl Command for Table {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("table")
.named(
"start_number",
"start-number",
SyntaxShape::Int,
"row number to start viewing from",
Some('n'),
@ -52,7 +52,7 @@ impl Command for Table {
let ctrlc = engine_state.ctrlc.clone();
let config = stack.get_config().unwrap_or_default();
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 term_width = if let Some((Width(w), Height(_h))) = terminal_size::terminal_size() {