From 789b2e603abe40657c1bce6f6b983b2af879ee69 Mon Sep 17 00:00:00 2001 From: WindSoilder Date: Sat, 18 Feb 2023 21:27:24 +0800 Subject: [PATCH] update nu_plugin_python due to signature changes (#8107) # Description As title.. # User-Facing Changes None # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --- .../nu_plugin_python_example.py | 130 +++++++++--------- 1 file changed, 67 insertions(+), 63 deletions(-) mode change 100644 => 100755 crates/nu_plugin_python/nu_plugin_python_example.py diff --git a/crates/nu_plugin_python/nu_plugin_python_example.py b/crates/nu_plugin_python/nu_plugin_python_example.py old mode 100644 new mode 100755 index e6a0f74d33..cfee53428b --- a/crates/nu_plugin_python/nu_plugin_python_example.py +++ b/crates/nu_plugin_python/nu_plugin_python_example.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # Example of using a Python script as a Nushell plugin # # The example uses JSON encoding but it should be a similar process using @@ -38,73 +39,76 @@ def signatures(): return { "Signature": [ { - "name": "nu-python", - "usage": "Signature test for Python", - "extra_usage": "", - "input_type": "Any", - "output_type": "Any", - "required_positional": [ - { - "name": "a", - "desc": "required integer value", - "shape": "Int", - "var_id": None, - }, - { - "name": "b", - "desc": "required string value", + "sig": { + "name": "nu-python", + "usage": "Signature test for Python", + "extra_usage": "", + "input_type": "Any", + "output_type": "Any", + "required_positional": [ + { + "name": "a", + "desc": "required integer value", + "shape": "Int", + "var_id": None, + }, + { + "name": "b", + "desc": "required string value", + "shape": "String", + "var_id": None, + }, + ], + "optional_positional": [ + { + "name": "opt", + "desc": "Optional number", + "shape": "Int", + "var_id": None, + } + ], + "rest_positional": { + "name": "rest", + "desc": "rest value string", "shape": "String", "var_id": None, }, - ], - "optional_positional": [ - { - "name": "opt", - "desc": "Optional number", - "shape": "Int", - "var_id": None, - } - ], - "rest_positional": { - "name": "rest", - "desc": "rest value string", - "shape": "String", - "var_id": None, + "vectorizes_over_list": False, + "named": [ + { + "long": "help", + "short": "h", + "arg": None, + "required": False, + "desc": "Display the help message for this command", + "var_id": None, + }, + { + "long": "flag", + "short": "f", + "arg": None, + "required": False, + "desc": "a flag for the signature", + "var_id": None, + }, + { + "long": "named", + "short": "n", + "arg": "String", + "required": False, + "desc": "named string", + "var_id": None, + }, + ], + "input_output_types": [["Any", "Any"]], + "allow_variants_without_examples": True, + "search_terms": ["Python", "Example"], + "is_filter": False, + "creates_scope": False, + "allows_unknown_args": False, + "category": "Experimental", }, - "vectorizes_over_list": False, - "named": [ - { - "long": "help", - "short": "h", - "arg": None, - "required": False, - "desc": "Display the help message for this command", - "var_id": None - }, - { - "long": "flag", - "short": "f", - "arg": None, - "required": False, - "desc": "a flag for the signature", - "var_id": None, - }, - { - "long": "named", - "short": "n", - "arg": "String", - "required": False, - "desc": "named string", - "var_id": None, - }, - ], - "input_output_types": [["Any", "Any"]], - "allow_variants_without_examples": True, - "search_terms": ["Python", "Example"], - "is_filter": False, - "creates_scope": False, - "allows_unknown_args": False, - "category": "Experimental", + "examples": [], } ] }