Files

62 lines
1.8 KiB
Go

// Command cletus-plugin creates, checks and runs Cletus plugins.
//
// cletus-plugin new <publisher>.<name> [folder]
// cletus-plugin check
// cletus-plugin run [flags] tools | invoke <tool> [json] | ui <method> [json array] | service <service.method> [json]
package main
import (
"fmt"
"os"
)
// sdkVersion is the SDK release new plugins require (tag sdk/<version>).
const sdkVersion = "v0.1.0"
func main() {
if len(os.Args) < 2 {
usage()
os.Exit(2)
}
var err error
switch os.Args[1] {
case "new":
err = runNew(os.Args[2:])
case "check":
err = runCheck(os.Args[2:])
case "run":
err = runRun(os.Args[2:])
case "version":
fmt.Println("cletus-plugin", sdkVersion)
case "help", "-h", "--help":
usage()
default:
usage()
os.Exit(2)
}
if err != nil {
fmt.Fprintln(os.Stderr, "cletus-plugin:", err)
os.Exit(1)
}
}
func usage() {
fmt.Fprint(os.Stderr, `cletus-plugin builds Cletus plugins.
cletus-plugin new <publisher>.<name> [folder] create a plugin from the template
cletus-plugin check run the store's automated checks here
cletus-plugin run [flags] <command> run the worker under the test host
tools list the chat tools
invoke <tool> [json] call a chat tool
ui <method> [json array] call a screen method
service <service.method> [json] call a provided service
flags: -files <dir> the folder the user "opened" (default: testdata)
-workspace <dir> simulate one shared folder backed by this directory
-edit the user allows edits (default: read-only)
-capability <name> a Cletus feature the user has (repeatable)
cletus-plugin version
Docs: https://git.eidonix.com/eidonix/cletus-plugins
`)
}