nushell/crates
Mathspy daa2148136
Add CustomValue support to plugins (#6070)
* Skeleton implementation

Lots and lots of TODOs

* Bootstrap simple CustomValue plugin support test

* Create nu_plugin_custom_value

* Skeleton for nu_plugin_custom_values

* Return a custom value from plugin

* Encode CustomValues from plugin calls as PluginResponse::PluginData

* Add new PluginCall variant CollapseCustomValue

* Handle CollapseCustomValue plugin calls

* Add CallInput::Data variant to CallInfo inputs

* Handle CallInfo with CallInput::Data plugin calls

* Send CallInput::Data if Value is PluginCustomValue from plugin calls

* Remove unnecessary boxing of plugins CallInfo

* Add fields needed to collapse PluginCustomValue to it

* Document PluginCustomValue and its purpose

* Impl collapsing using plugin calls in PluginCustomValue::to_base_value

* Implement proper typetag based deserialization for CoolCustomValue

* Test demonstrating that passing back a custom value to plugin works

* Added a failing test for describing plugin CustomValues

* Support describe for PluginCustomValues

- Add name to PluginResponse::PluginData
  - Also turn it into a struct for clarity
- Add name to PluginCustomValue
- Return name field from PluginCustomValue

* Demonstrate that plugins can create and handle multiple CustomValues

* Add bincode to nu-plugin dependencies

This is for demonstration purposes, any schemaless binary seralization
format will work. I picked bincode since it's the most popular for Rust
but there are defintely better options out there for this usecase

* serde_json::Value -> Vec<u8>

* Update capnp schema for new CallInfo.input field

* Move call_input capnp serialization and deserialization into new file

* Deserialize Value's span from Value itself instead of passing call.head

I am not sure if this was correct and I am breaking it or if it was a
bug, I don't fully understand how nu creates and uses Spans. What should
reuse spans and what should recreate new ones?
But yeah it felt weird that the Value's Span was being ignored since in
the json serializer just uses the Value's Span

* Add call_info value round trip test

* Add capnp CallInput::Data serialization and deserialization support

* Add CallInfo::CollapseCustomValue to capnp schema

* Add capnp PluginCall::CollapseCustomValue serialization and deserialization support

* Add PluginResponse::PluginData to capnp schema

* Add capnp PluginResponse::PluginData serialization and deserialization support

* Switch plugins::custom_values tests to capnp

Both json and capnp would work now! Sadly I can't choose both at the
same time :(

* Add missing JsonSerializer round trip tests

* Handle plugin returning PluginData as a response to CollapseCustomValue

* Refactor plugin calling into a reusable function

Many less levels of indentation now!

* Export PluginData from nu_plugin

So plugins can create their very own serve_plugin with whatever
CustomValue behavior they may desire

* Error if CustomValue cannot be handled by Plugin
2022-07-25 17:32:56 +01:00
..
nu-cli move the shell integration title setting to the right place (#6112) 2022-07-24 09:01:59 -05:00
nu-color-config Bump to 0.65.1 dev version (#5962) 2022-07-06 16:25:09 +12:00
nu-command fix typo of port command (#6120) 2022-07-25 07:07:26 -05:00
nu-engine Refactor external command (#6083) 2022-07-21 19:56:57 -04:00
nu-glob Bump to 0.65.1 dev version (#5962) 2022-07-06 16:25:09 +12:00
nu-json Prevents panic when parsing JSON containing large number (#6096) 2022-07-23 13:31:06 +12:00
nu-parser Refactor external command (#6083) 2022-07-21 19:56:57 -04:00
nu-path Allow mv multiple files at once (#6103) 2022-07-23 07:51:41 -05:00
nu-plugin Add CustomValue support to plugins (#6070) 2022-07-25 17:32:56 +01:00
nu-pretty-hex Bump to 0.65.1 dev version (#5962) 2022-07-06 16:25:09 +12:00
nu-protocol Simplify PipelineData::print (#6119) 2022-07-25 06:38:21 -05:00
nu-system Fix ps command on linux (#6047) 2022-07-14 06:20:54 -05:00
nu-table nu-table/ Bump tabled version (#6097) 2022-07-22 10:33:29 -05:00
nu-term-grid Bump to 0.65.1 dev version (#5962) 2022-07-06 16:25:09 +12:00
nu-test-support Restore nu_with_plugins test macro (#6065) 2022-07-22 00:14:37 -04:00
nu-utils enable find to be able to highlight some hits (#6086) 2022-07-20 10:09:33 -05:00
nu_plugin_custom_values Add CustomValue support to plugins (#6070) 2022-07-25 17:32:56 +01:00
nu_plugin_example Bump to 0.65.1 dev version (#5962) 2022-07-06 16:25:09 +12:00
nu_plugin_gstat fix documentation of plugin encodings (#6052) 2022-07-15 05:28:14 -05:00
nu_plugin_inc Bump to 0.65.1 dev version (#5962) 2022-07-06 16:25:09 +12:00
nu_plugin_python Fix Python plugin (missing search terms) (#5083) 2022-04-03 20:00:53 -05:00
nu_plugin_query fix documentation of plugin encodings (#6052) 2022-07-15 05:28:14 -05:00
old Bump to 0.65.1 dev version (#5962) 2022-07-06 16:25:09 +12:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.