mirror of
https://github.com/lancatlin/mdsh.git
synced 2026-11-05 19:30:12 +08:00
feat: parse template meta
This commit is contained in:
1 parent
70837bf6b1
commit
99f6e8cefd
5 files changed
+53
-2
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type TemplateMeta struct {
|
||||
Output string `yaml:"output"`
|
||||
Params map[string]ParamSpec `yaml:"params"`
|
||||
}
|
||||
|
||||
func (meta TemplateMeta) String() string {
|
||||
data, err := json.Marshal(meta)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return string(data)
|
||||
}
|
||||
|
||||
type ParamSpec struct {
|
||||
Required bool `yaml:"required"`
|
||||
Default string `yaml:"default"`
|
||||
}
|
||||
Reference in new issue
Block a user