mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 18:10:21 +00:00
Chore: organize appliesToWorkloads field of trait defs, add doc example (#4483)
* Chore: organize appliesToWorkloads field of trait defs, add doc example Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * fix gen Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * add deprecate label Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * fix Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * fix script to read all definition in directory Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * add comment Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * go.mod Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * update some usage, better trait doc gen Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * minor fix Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * minor fix Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com> * postpone markdown escape pipe char Signed-off-by: qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
This commit is contained in:
@@ -86,7 +86,9 @@ func TraitDef(ctx context.Context, c common.Args, path, location *string, defdir
|
||||
},
|
||||
CustomDocHeader: CustomTraitHeaderEN,
|
||||
}
|
||||
ref.Remote = &docgen.FromCluster{Namespace: types.DefaultKubeVelaNS}
|
||||
ref.Local = &docgen.FromLocal{
|
||||
Path: TraitDefDir,
|
||||
}
|
||||
|
||||
if *path != "" {
|
||||
ref.I18N = &docgen.En
|
||||
@@ -99,22 +101,24 @@ func TraitDef(ctx context.Context, c common.Args, path, location *string, defdir
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("trait reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), *path)
|
||||
}
|
||||
if *location == "" || *location == "en" {
|
||||
ref.I18N = &docgen.En
|
||||
if err := ref.GenerateReferenceDocs(ctx, c, TraitDefRefPath); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
} else {
|
||||
// Generate to default path depends on language
|
||||
if *location == "" || *location == "en" {
|
||||
ref.I18N = &docgen.En
|
||||
if err := ref.GenerateReferenceDocs(ctx, c, TraitDefRefPath); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("trait reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), TraitDefRefPath)
|
||||
}
|
||||
fmt.Printf("trait reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), TraitDefRefPath)
|
||||
}
|
||||
if *location == "" || *location == "zh" {
|
||||
ref.I18N = &docgen.Zh
|
||||
ref.CustomDocHeader = CustomTraitHeaderZH
|
||||
if err := ref.GenerateReferenceDocs(ctx, c, TraitDefRefPathZh); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
if *location == "" || *location == "zh" {
|
||||
ref.I18N = &docgen.Zh
|
||||
ref.CustomDocHeader = CustomTraitHeaderZH
|
||||
if err := ref.GenerateReferenceDocs(ctx, c, TraitDefRefPathZh); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("trait reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), TraitDefRefPathZh)
|
||||
}
|
||||
fmt.Printf("trait reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), TraitDefRefPathZh)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user