Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions contributor-book/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down Expand Up @@ -1052,7 +1052,7 @@ def send_hello():
hello = {
"Hello": {
"protocol": "nu-plugin",
"version": "0.90.2",
"version": "0.100.0",
"features": []
}
}
Expand Down Expand Up @@ -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"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only part that gives me pause. Seems odd that we'd have to get the 0th element, but maybe that's right?

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)
Expand Down Expand Up @@ -1176,7 +1179,7 @@ def send_hello():
hello = {
"Hello": {
"protocol": "nu-plugin",
"version": "0.90.2",
"version": "0.100.0",
"features": []
}
}
Expand All @@ -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)
Expand Down