add category docker & kube (#276)

This commit is contained in:
Kevin Wan
2020-12-11 18:53:40 +08:00
committed by GitHub
parent 99596a4149
commit da8f76e6bd
10 changed files with 104 additions and 70 deletions

View File

@@ -54,6 +54,14 @@ var templates = map[string]string{
errTemplateFile: template.Error,
}
func Category() string {
return category
}
func Clean() error {
return util.Clean(category)
}
func GenTemplates(_ *cli.Context) error {
return util.InitTemplates(category, templates)
}
@@ -66,18 +74,10 @@ func RevertTemplate(name string) error {
return util.CreateTemplate(category, name, content)
}
func Clean() error {
return util.Clean(category)
}
func Update(category string) error {
func Update() error {
err := Clean()
if err != nil {
return err
}
return util.InitTemplates(category, templates)
}
func GetCategory() string {
return category
}

View File

@@ -85,7 +85,7 @@ func TestUpdate(t *testing.T) {
assert.Equal(t, string(data), modifyData)
assert.Nil(t, Update(category))
assert.Nil(t, Update())
data, err = ioutil.ReadFile(file)
assert.Nil(t, err)