zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
20.91k stars 639 forks source link

Plugin give an optional reason why a permission is needed #3365

Open Zykino opened 4 months ago

Zykino commented 4 months ago

The optional string would be to print a sort of table (if there is place). I don’t have a screenshot of the permissions on hand but for the weather plugin I feel it would look like:

The plugin is requesting permissions: WebRequest: to get the weather information online WriteToStdin: to transfer the weather information to the CLI if you want to OpenFiles Give the permissions? (y/n)

In this example the OpenFiles did not have the optional "reason"/description string.

I would see the API changing more or less as follow:

struct RequestPermission {
  pub Type: PermissionType;
  pub Reason: Option<String>;
}

pub fn request_permission(permissions: &[RequestPermission])