mirror of
https://github.com/nushell/nushell.git
synced 2024-11-08 09:34:30 +01:00
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.
This commit is contained in:
parent
01ade02ac1
commit
f8939de14f
@ -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<CellPath> = 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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user