awf-plugin-echo

command
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2026 License: EUPL-1.2 Imports: 3 Imported by: 0

README

awf-plugin-echo

Example AWF plugin demonstrating the sdk.Serve() pattern. Exposes a single echo operation that returns its input text unchanged.

Build and Install

make install

This builds the plugin binary and installs it alongside plugin.yaml into ~/.local/share/awf/plugins/awf-plugin-echo/.

Operations

echo

Returns the input text, optionally prefixed.

Input Type Required Description
text string Yes Text to echo
prefix string No Optional prefix prepended to the output
Output Type Description
output string Echoed text (with optional prefix)
text string Original input text
prefix string Prefix used (empty string if none)

Usage in Workflows

name: echo-example
version: "1.0.0"

states:
  initial: say_hello

  say_hello:
    type: operation
    operation: awf-plugin-echo.echo
    inputs:
      text: "Hello, AWF!"
      prefix: ">>>"
    on_success: done
    on_failure: error

  done:
    type: terminal
    status: success

  error:
    type: terminal
    status: failure

Enable the plugin first:

awf plugin enable awf-plugin-echo
awf run echo-example

Plugin Structure

package main

import (
    "context"

    "github.com/awf-project/cli/pkg/plugin/sdk"
)

type EchoPlugin struct {
    sdk.BasePlugin
}

func (p *EchoPlugin) Operations() []string {
    return []string{"echo"}
}

func (p *EchoPlugin) HandleOperation(_ context.Context, name string, inputs map[string]any) (*sdk.OperationResult, error) {
    text := sdk.GetStringDefault(inputs, "text", "")
    return sdk.NewSuccessResult(text, nil), nil
}

func main() {
    sdk.Serve(&EchoPlugin{
        BasePlugin: sdk.BasePlugin{
            PluginName:    "awf-plugin-echo",
            PluginVersion: "1.0.0",
        },
    })
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL