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:
Jérémy Audiger
2023-02-05 22:17:46 +01:00
committed by GitHub
parent a0e3ad2b70
commit 99076af18b
236 changed files with 469 additions and 409 deletions

View File

@ -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(),

View File

@ -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")?;

View File

@ -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)
}
}

View File

@ -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");

View File

@ -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");

View File

@ -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,

View File

@ -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();

View File

@ -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)
}

View File

@ -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")?;

View File

@ -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)
}