| 1 |
package main |
| 2 |
|
| 3 |
import ( |
| 4 |
"encoding/json" |
| 5 |
"flag" |
| 6 |
"os" |
| 7 |
) |
| 8 |
|
| 9 |
func main() { |
| 10 |
flag.Parse() |
| 11 |
if flag.NArg() < 1 { |
| 12 |
os.Exit(1) |
| 13 |
} |
| 14 |
if flag.Arg(0) == "get-plugin-metadata" { |
| 15 |
// This does not import notation-go/plugin to simplify testing setup. |
| 16 |
m := struct { |
| 17 |
Name string `json:"name"` |
| 18 |
Description string `json:"description"` |
| 19 |
Version string `json:"version"` |
| 20 |
URL string `json:"url"` |
| 21 |
SupportedContractVersions []string `json:"supportedContractVersions"` |
| 22 |
Capabilities []string `json:"capabilities"` |
| 23 |
}{Name: "foo", Description: "friendly", Version: "1", URL: "example.com", SupportedContractVersions: []string{"1.0"}, Capabilities: []string{"cap"}} |
| 24 |
data, err := json.Marshal(&m) |
| 25 |
if err != nil { |
| 26 |
panic(err) |
| 27 |
} |
| 28 |
os.Stdout.Write(data) |
| 29 |
} |
| 30 |
} |