forked from extern/nushell
feat: mark str to-datetime as deprecated command (#4448)
This commit is contained in:
parent
c5e7bccee5
commit
560be6e73e
@ -354,6 +354,7 @@ pub fn create_default_context(cwd: impl AsRef<Path>) -> EngineState {
|
|||||||
bind_command! {
|
bind_command! {
|
||||||
InsertDeprecated,
|
InsertDeprecated,
|
||||||
PivotDeprecated,
|
PivotDeprecated,
|
||||||
|
StrDatetimeDeprecated,
|
||||||
StrDecimalDeprecated,
|
StrDecimalDeprecated,
|
||||||
StrIntDeprecated,
|
StrIntDeprecated,
|
||||||
NthDeprecated,
|
NthDeprecated,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
mod insert;
|
mod insert;
|
||||||
mod nth;
|
mod nth;
|
||||||
mod pivot;
|
mod pivot;
|
||||||
|
mod str_datetime;
|
||||||
mod str_decimal;
|
mod str_decimal;
|
||||||
mod str_int;
|
mod str_int;
|
||||||
mod unalias;
|
mod unalias;
|
||||||
@ -8,6 +9,7 @@ mod unalias;
|
|||||||
pub use insert::InsertDeprecated;
|
pub use insert::InsertDeprecated;
|
||||||
pub use nth::NthDeprecated;
|
pub use nth::NthDeprecated;
|
||||||
pub use pivot::PivotDeprecated;
|
pub use pivot::PivotDeprecated;
|
||||||
|
pub use str_datetime::StrDatetimeDeprecated;
|
||||||
pub use str_decimal::StrDecimalDeprecated;
|
pub use str_decimal::StrDecimalDeprecated;
|
||||||
pub use str_int::StrIntDeprecated;
|
pub use str_int::StrIntDeprecated;
|
||||||
pub use unalias::UnaliasDeprecated;
|
pub use unalias::UnaliasDeprecated;
|
||||||
|
36
crates/nu-command/src/deprecated/str_datetime.rs
Normal file
36
crates/nu-command/src/deprecated/str_datetime.rs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
use nu_protocol::{
|
||||||
|
ast::Call,
|
||||||
|
engine::{Command, EngineState, Stack},
|
||||||
|
Category, PipelineData, Signature,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct StrDatetimeDeprecated;
|
||||||
|
|
||||||
|
impl Command for StrDatetimeDeprecated {
|
||||||
|
fn name(&self) -> &str {
|
||||||
|
"str to-datetime"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn signature(&self) -> Signature {
|
||||||
|
Signature::build(self.name()).category(Category::Deprecated)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn usage(&self) -> &str {
|
||||||
|
"Deprecated command"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn run(
|
||||||
|
&self,
|
||||||
|
_engine_state: &EngineState,
|
||||||
|
_stack: &mut Stack,
|
||||||
|
call: &Call,
|
||||||
|
_input: PipelineData,
|
||||||
|
) -> Result<nu_protocol::PipelineData, nu_protocol::ShellError> {
|
||||||
|
Err(nu_protocol::ShellError::DeprecatedCommand(
|
||||||
|
self.name().to_string(),
|
||||||
|
"into datetime".to_string(),
|
||||||
|
call.head,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user