-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.swift
44 lines (34 loc) · 935 Bytes
/
Plugin.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Plugin.swift
// ExamplePlugin
//
// Created by Joe McBride on 12/6/21.
//
import Foundation
import Plugins
@objc public class ExamplePlugin: NSObject, OPlugin {
private var host: IHost?
public var name: String = "Example Plugin"
public required override init() {
super.init()
}
public func initialize(host: IHost) {
self.host = host
}
public func variableChanged(variable: String, value: String) {
}
public func parse(input: String) -> String {
let trimmed = input.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
guard trimmed.hasPrefix("/example") else {
return input
}
host?.send(text: "#echo Example Plugin v3!")
return ""
}
public func parse(xml: String) -> String {
return xml
}
public func parse(text: String) -> String {
return text
}
}