Skip to main content

parse_annotations

Function parse_annotations 

Source
pub fn parse_annotations(src: &str) -> Result<ScriptToolMeta>
Expand description

Parse a script tool’s metadata from its .rhai source comment annotations.

Recognized leading //-comment directives (order-independent):

  • // @tool <name> - required; names the tool.
  • // @description <text> - optional one-liner.
  • // @param <name> <type> <required|optional> "<description>" - repeatable.
  • // @requires <cap> [<cap>...] - platform capabilities the tool needs (network, shell, filesystem); comma/space-separated, repeatable.

Non-comment / unrecognized lines are ignored, so a script can mix ordinary comments with directives. A missing @tool name is an error.