From 694837e96fb6725487d6ded3f66caa78c7ead506 Mon Sep 17 00:00:00 2001 From: Jim Riordan Date: Sun, 24 Nov 2024 07:03:31 +1100 Subject: [PATCH] Update python plugin example for compatibility with v0.100.0 --- contributor-book/plugins.md | 42 +++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/contributor-book/plugins.md b/contributor-book/plugins.md index 41ccbed9bea..0ce7fcc0292 100644 --- a/contributor-book/plugins.md +++ b/contributor-book/plugins.md @@ -1020,8 +1020,8 @@ def signature(): return { "sig": { "name": "len", - "usage": "calculates the length of its input", - "extra_usage": "", + "description": "calculates the length of its input", + "extra_description": "", "search_terms": [], "required_positional": [], "optional_positional": [], @@ -1052,7 +1052,7 @@ def send_hello(): hello = { "Hello": { "protocol": "nu-plugin", - "version": "0.90.2", + "version": "0.100.0", "features": [] } } @@ -1081,15 +1081,18 @@ def send_error(id, error_msg, span): def handle_call(id, call_info): try: - input = call_info["input"]["Value"]["String"] + input = call_info["input"]["Value"][0]["String"] output = { "PipelineData": { - "Value": { - "Int": { - "val": len(input["val"]), - "span": input["span"] - } - } + "Value": [ + { + "Int": { + "val": len(input["val"]), + "span": input["span"] + } + }, + None + ] } } send_response(id, output) @@ -1176,7 +1179,7 @@ def send_hello(): hello = { "Hello": { "protocol": "nu-plugin", - "version": "0.90.2", + "version": "0.100.0", "features": [] } } @@ -1195,15 +1198,18 @@ When sent a `Run` request, we parse the supplied JSON and respond to the request ```python def handle_call(id, call_info): try: - input = call_info["input"]["Value"]["String"] + input = call_info["input"]["Value"][0]["String"] output = { "PipelineData": { - "Value": { - "Int": { - "val": len(input["val"]), - "span": input["span"] - } - } + "Value": [ + { + "Int": { + "val": len(input["val"]), + "span": input["span"] + } + }, + None + ] } } send_response(id, output)