From 087fe484f668e1f98c170b365e1796c478a85887 Mon Sep 17 00:00:00 2001 From: Matthias Meschede Date: Wed, 5 Mar 2025 17:22:21 +0100 Subject: [PATCH] Enhance polars plugin documentation (#15250) This PR (based on #15249 and #15248 because it mentions them) adds extra documentation to the main polars command outlining the main datatypes that are used by the plugin. The lack of a description of the types involved in `polars xxx` commands was quite confusing to me when I started using the plugin and this is a first try improving it. I didn't find a better place but please let me know what you think. --- .../src/dataframe/command/stub.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/nu_plugin_polars/src/dataframe/command/stub.rs b/crates/nu_plugin_polars/src/dataframe/command/stub.rs index ff8d80fcca..921ce3bd3d 100644 --- a/crates/nu_plugin_polars/src/dataframe/command/stub.rs +++ b/crates/nu_plugin_polars/src/dataframe/command/stub.rs @@ -24,7 +24,21 @@ impl PluginCommand for PolarsCmd { } fn extra_description(&self) -> &str { - "You must use one of the following subcommands. Using this command as-is will only produce this help message." + r#" +You must use one of the subcommands below. Using this command as-is will only produce this help message. + +The following are the main datatypes (wrapped from Polars) that are used by these subcommands: + +Lazy and Strict dataframes (called `NuLazyFrame` and `NuDataFrame` in error messages) are the main +data structure. + +Expressions, representing various column operations (called `NuExpression`), are passed to many commands such as +`polars filter` or `polars with-column`. Most nushell operators are supported in these expressions, importantly +arithmetic, comparison and boolean logical. + +Groupbys (`NuLazyGroupBy`), the output of a `polars group-by`, represent a grouped dataframe and are typically piped +to the `polars agg` command with some column expressions for aggregation which then returns a dataframe. +"# } fn run(