mirror of
https://github.com/nushell/nushell.git
synced 2025-05-08 20:14:26 +02:00
feat(polars): rename polars replace
to polars str-replace
and polars replace-all
to polars str-replace-all
This commit is contained in:
parent
a340511e95
commit
f264f656ff
@ -1,9 +1,9 @@
|
|||||||
mod concat_str;
|
mod concat_str;
|
||||||
mod contains;
|
mod contains;
|
||||||
mod replace;
|
|
||||||
mod replace_all;
|
|
||||||
mod str_join;
|
mod str_join;
|
||||||
mod str_lengths;
|
mod str_lengths;
|
||||||
|
mod str_replace;
|
||||||
|
mod str_replace_all;
|
||||||
mod str_slice;
|
mod str_slice;
|
||||||
mod str_split;
|
mod str_split;
|
||||||
mod str_strip_chars;
|
mod str_strip_chars;
|
||||||
@ -15,10 +15,10 @@ use nu_plugin::PluginCommand;
|
|||||||
|
|
||||||
pub use concat_str::ExprConcatStr;
|
pub use concat_str::ExprConcatStr;
|
||||||
pub use contains::Contains;
|
pub use contains::Contains;
|
||||||
pub use replace::Replace;
|
|
||||||
pub use replace_all::ReplaceAll;
|
|
||||||
pub use str_join::StrJoin;
|
pub use str_join::StrJoin;
|
||||||
pub use str_lengths::StrLengths;
|
pub use str_lengths::StrLengths;
|
||||||
|
pub use str_replace::StrReplace;
|
||||||
|
pub use str_replace_all::StrReplaceAll;
|
||||||
pub use str_slice::StrSlice;
|
pub use str_slice::StrSlice;
|
||||||
pub use to_lowercase::ToLowerCase;
|
pub use to_lowercase::ToLowerCase;
|
||||||
pub use to_uppercase::ToUpperCase;
|
pub use to_uppercase::ToUpperCase;
|
||||||
@ -27,8 +27,8 @@ pub(crate) fn string_commands() -> Vec<Box<dyn PluginCommand<Plugin = PolarsPlug
|
|||||||
vec![
|
vec![
|
||||||
Box::new(ExprConcatStr),
|
Box::new(ExprConcatStr),
|
||||||
Box::new(Contains),
|
Box::new(Contains),
|
||||||
Box::new(Replace),
|
Box::new(StrReplace),
|
||||||
Box::new(ReplaceAll),
|
Box::new(StrReplaceAll),
|
||||||
Box::new(str_split::StrSplit),
|
Box::new(str_split::StrSplit),
|
||||||
Box::new(str_strip_chars::StrStripChars),
|
Box::new(str_strip_chars::StrStripChars),
|
||||||
Box::new(StrJoin),
|
Box::new(StrJoin),
|
||||||
|
@ -16,13 +16,13 @@ use nu_protocol::{
|
|||||||
use polars::prelude::{lit, IntoSeries, StringNameSpaceImpl};
|
use polars::prelude::{lit, IntoSeries, StringNameSpaceImpl};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Replace;
|
pub struct StrReplace;
|
||||||
|
|
||||||
impl PluginCommand for Replace {
|
impl PluginCommand for StrReplace {
|
||||||
type Plugin = PolarsPlugin;
|
type Plugin = PolarsPlugin;
|
||||||
|
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"polars replace"
|
"polars str-replace"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn description(&self) -> &str {
|
fn description(&self) -> &str {
|
||||||
@ -61,7 +61,7 @@ impl PluginCommand for Replace {
|
|||||||
Example {
|
Example {
|
||||||
description: "Replaces string in column",
|
description: "Replaces string in column",
|
||||||
example:
|
example:
|
||||||
"[[a]; [abc] [abcabc]] | polars into-df | polars select (polars col a | polars replace --pattern ab --replace AB) | polars collect",
|
"[[a]; [abc] [abcabc]] | polars into-df | polars select (polars col a | polars str-replace --pattern ab --replace AB) | polars collect",
|
||||||
result: Some(
|
result: Some(
|
||||||
NuDataFrame::try_from_columns(
|
NuDataFrame::try_from_columns(
|
||||||
vec![Column::new(
|
vec![Column::new(
|
||||||
@ -80,7 +80,7 @@ impl PluginCommand for Replace {
|
|||||||
Example {
|
Example {
|
||||||
description: "Replaces string",
|
description: "Replaces string",
|
||||||
example:
|
example:
|
||||||
"[abc abc abc] | polars into-df | polars replace --pattern ab --replace AB",
|
"[abc abc abc] | polars into-df | polars str-replace --pattern ab --replace AB",
|
||||||
result: Some(
|
result: Some(
|
||||||
NuDataFrame::try_from_columns(
|
NuDataFrame::try_from_columns(
|
||||||
vec![Column::new(
|
vec![Column::new(
|
||||||
@ -197,6 +197,6 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_examples() -> Result<(), ShellError> {
|
fn test_examples() -> Result<(), ShellError> {
|
||||||
test_polars_plugin_command(&Replace)
|
test_polars_plugin_command(&StrReplace)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,13 +16,13 @@ use nu_protocol::{
|
|||||||
use polars::prelude::{lit, IntoSeries, StringNameSpaceImpl};
|
use polars::prelude::{lit, IntoSeries, StringNameSpaceImpl};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ReplaceAll;
|
pub struct StrReplaceAll;
|
||||||
|
|
||||||
impl PluginCommand for ReplaceAll {
|
impl PluginCommand for StrReplaceAll {
|
||||||
type Plugin = PolarsPlugin;
|
type Plugin = PolarsPlugin;
|
||||||
|
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"polars replace-all"
|
"polars str-replace-all"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn description(&self) -> &str {
|
fn description(&self) -> &str {
|
||||||
@ -61,7 +61,7 @@ impl PluginCommand for ReplaceAll {
|
|||||||
Example {
|
Example {
|
||||||
description: "Replaces string in a column",
|
description: "Replaces string in a column",
|
||||||
example:
|
example:
|
||||||
"[[a]; [abac] [abac] [abac]] | polars into-df | polars select (polars col a | polars replace-all --pattern a --replace A) | polars collect",
|
"[[a]; [abac] [abac] [abac]] | polars into-df | polars select (polars col a | polars str-replace-all --pattern a --replace A) | polars collect",
|
||||||
result: Some(
|
result: Some(
|
||||||
NuDataFrame::try_from_columns(
|
NuDataFrame::try_from_columns(
|
||||||
vec![Column::new(
|
vec![Column::new(
|
||||||
@ -81,7 +81,7 @@ impl PluginCommand for ReplaceAll {
|
|||||||
Example {
|
Example {
|
||||||
description: "Replaces string",
|
description: "Replaces string",
|
||||||
example:
|
example:
|
||||||
"[abac abac abac] | polars into-df | polars replace-all --pattern a --replace A",
|
"[abac abac abac] | polars into-df | polars str-replace-all --pattern a --replace A",
|
||||||
result: Some(
|
result: Some(
|
||||||
NuDataFrame::try_from_columns(
|
NuDataFrame::try_from_columns(
|
||||||
vec![Column::new(
|
vec![Column::new(
|
||||||
@ -198,6 +198,6 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_examples() -> Result<(), ShellError> {
|
fn test_examples() -> Result<(), ShellError> {
|
||||||
test_polars_plugin_command(&ReplaceAll)
|
test_polars_plugin_command(&StrReplaceAll)
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user