forked from extern/nushell
Use imported names in Command::run
signatures (#7967)
# Description _(Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes.)_ I opened this PR to unify the run command method. It's mainly to improve consistency across the tree. # User-Facing Changes None. # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
@ -31,7 +31,7 @@ impl Command for From {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
_input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
Ok(Value::String {
|
||||
val: get_full_help(
|
||||
&From.signature(),
|
||||
|
@ -49,7 +49,7 @@ impl Command for FromCsv {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
from_csv(engine_state, stack, call, input)
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ impl Command for FromEml {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
let preview_body: Option<Spanned<i64>> =
|
||||
call.get_flag(engine_state, stack, "preview-body")?;
|
||||
|
@ -34,7 +34,7 @@ impl Command for FromIcs {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
from_ics(input, head)
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ b=2' | from ini",
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
from_ini(input, head)
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ impl Command for FromJson {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let span = call.head;
|
||||
let (string_input, span, metadata) = input.collect_string_strict(span)?;
|
||||
|
||||
|
@ -57,7 +57,7 @@ impl Command for FromNuon {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
let (string_input, _span, metadata) = input.collect_string_strict(head)?;
|
||||
|
||||
|
@ -39,7 +39,7 @@ impl Command for FromOds {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
|
||||
let sel_sheets = if let Some(Value::List { vals: columns, .. }) =
|
||||
|
@ -60,7 +60,7 @@ impl Command for FromSsv {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
from_ssv(engine_state, stack, call, input)
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ b = [1, 2]' | from toml",
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let span = call.head;
|
||||
let (mut string_input, span, metadata) = input.collect_string_strict(span)?;
|
||||
string_input.push('\n');
|
||||
|
@ -43,7 +43,7 @@ impl Command for FromTsv {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
from_tsv(engine_state, stack, call, input)
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ impl Command for FromUrl {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
from_url(input, head)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ impl Command for FromVcf {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
from_vcf(input, head)
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ impl Command for FromXlsx {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
|
||||
let sel_sheets = if let Some(Value::List { vals: columns, .. }) =
|
||||
|
@ -30,7 +30,7 @@ impl Command for FromXml {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
from_xml(input, head)
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ impl Command for FromYaml {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
from_yaml(input, head)
|
||||
}
|
||||
@ -66,7 +66,7 @@ impl Command for FromYml {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
from_yaml(input, head)
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ impl Command for To {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
_input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
Ok(Value::String {
|
||||
val: get_full_help(
|
||||
&To.signature(),
|
||||
|
@ -65,7 +65,7 @@ impl Command for ToCsv {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
let noheaders = call.has_flag("noheaders");
|
||||
let separator: Option<Spanned<String>> = call.get_flag(engine_state, stack, "separator")?;
|
||||
|
@ -157,7 +157,7 @@ impl Command for ToHtml {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
to_html(input, call, engine_state, stack)
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ impl Command for ToJson {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let raw = call.has_flag("raw");
|
||||
let use_tabs = call.has_flag("tabs");
|
||||
|
||||
|
@ -70,7 +70,7 @@ impl Command for ToMd {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
let pretty = call.has_flag("pretty");
|
||||
let per_element = call.has_flag("per-element");
|
||||
|
@ -33,7 +33,7 @@ impl Command for ToNuon {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
Ok(Value::String {
|
||||
val: to_nuon(call, input)?,
|
||||
span: call.head,
|
||||
|
@ -30,7 +30,7 @@ impl Command for ToText {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let span = call.head;
|
||||
let config = engine_state.get_config();
|
||||
|
||||
|
@ -36,7 +36,7 @@ impl Command for ToToml {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
to_toml(engine_state, input, head)
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ impl Command for ToXml {
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
let config = engine_state.get_config();
|
||||
let pretty: Option<Spanned<i64>> = call.get_flag(engine_state, stack, "pretty")?;
|
||||
|
@ -36,7 +36,7 @@ impl Command for ToYaml {
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let head = call.head;
|
||||
to_yaml(input, head)
|
||||
}
|
||||
|
Reference in New Issue
Block a user