From f8939de14fd5d74fa35299cb95e5c09ce016d05c Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:54:20 +0200 Subject: [PATCH] Remove `str replace --string` after deprecation (#10064) related to - https://github.com/nushell/nushell/pull/10038 # Description `str replace --string` has been deprecated in https://github.com/nushell/nushell/pull/10038 and should be removed before 0.85. this PR removes the `--string` option from `str replace` completely. # User-Facing Changes `str replace --string` will no longer work and will give an error instead of a warning. --- crates/nu-command/src/strings/str_/replace.rs | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/crates/nu-command/src/strings/str_/replace.rs b/crates/nu-command/src/strings/str_/replace.rs index 607f9a5637..30e900a332 100644 --- a/crates/nu-command/src/strings/str_/replace.rs +++ b/crates/nu-command/src/strings/str_/replace.rs @@ -4,8 +4,8 @@ use nu_engine::CallExt; use nu_protocol::{ ast::{Call, CellPath}, engine::{Command, EngineState, Stack}, - report_error_new, Category, Example, PipelineData, Record, ShellError, Signature, Span, - Spanned, SyntaxShape, Type, Value, + Category, Example, PipelineData, Record, ShellError, Signature, Span, Spanned, SyntaxShape, + Type, Value, }; struct Arguments { @@ -57,11 +57,6 @@ impl Command for SubCommand { "do not expand capture groups (like $name) in the replacement string", Some('n'), ) - .switch( - "string", - "DEPRECATED option, will be removed in 0.85. Substring matching is now the default.", - Some('s'), - ) .switch( "regex", "match the pattern as a regular expression in the input, instead of a substring", @@ -96,18 +91,6 @@ impl Command for SubCommand { let cell_paths: Vec = call.rest(engine_state, stack, 2)?; let cell_paths = (!cell_paths.is_empty()).then_some(cell_paths); let literal_replace = call.has_flag("no-expand"); - if call.has_flag("string") { - report_error_new( - engine_state, - &ShellError::GenericError( - "Deprecated option".into(), - "`str replace --string` is deprecated and will be removed in 0.85.".into(), - Some(call.head), - Some("Substring matching is now the default. Use `--regex` or `--multiline` for matching regular expressions.".into()), - vec![], - ), - ); - } let no_regex = !call.has_flag("regex") && !call.has_flag("multiline"); let multiline = call.has_flag("multiline");