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.
This commit is contained in:
Matthias Meschede 2025-03-05 17:22:21 +01:00 committed by GitHub
parent 551fecd10d
commit 087fe484f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(