mirror of
https://github.com/nushell/nushell
synced 2025-01-06 18:29:02 +00:00
5b01685fc3
# Description This updates all the positional arguments (except with `--features=dataframe` or `--features=extra`) to start with an uppercase letter and end with a period. Part of #5066, specifically [this comment](/nushell/nushell/issues/5066#issuecomment-1421528910) Some arguments had example data removed from them because it also appears in the examples. There are other inconsistencies in positional arguments I noticed while making the tests pass which I will bring up in #5066. # User-Facing Changes Positional arguments are now consistent # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting Automatic documentation updates
46 lines
1.3 KiB
Rust
46 lines
1.3 KiB
Rust
use nu_protocol::ast::Call;
|
|
use nu_protocol::engine::{Command, EngineState, Stack};
|
|
use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape, Type};
|
|
|
|
#[derive(Clone)]
|
|
pub struct SubCommand;
|
|
|
|
impl Command for SubCommand {
|
|
fn name(&self) -> &str {
|
|
"date format"
|
|
}
|
|
|
|
fn signature(&self) -> Signature {
|
|
Signature::build("date format")
|
|
.input_output_types(vec![
|
|
(Type::Date, Type::String),
|
|
(Type::String, Type::String),
|
|
])
|
|
.allow_variants_without_examples(true) // https://github.com/nushell/nushell/issues/7032
|
|
.switch("list", "lists strftime cheatsheet", Some('l'))
|
|
.optional(
|
|
"format string",
|
|
SyntaxShape::String,
|
|
"The desired date format.",
|
|
)
|
|
.category(Category::Removed)
|
|
}
|
|
|
|
fn usage(&self) -> &str {
|
|
"Removed command: use `format date` instead."
|
|
}
|
|
|
|
fn run(
|
|
&self,
|
|
_engine_state: &EngineState,
|
|
_stack: &mut Stack,
|
|
call: &Call,
|
|
_input: PipelineData,
|
|
) -> Result<PipelineData, ShellError> {
|
|
Err(nu_protocol::ShellError::RemovedCommand {
|
|
removed: self.name().to_string(),
|
|
replacement: "format date".to_owned(),
|
|
span: call.head,
|
|
})
|
|
}
|
|
}
|