mirror of
https://gitea.com/gitea/go-fed-activity.git
synced 2024-06-01 09:46:47 +05:30
Add flag for generating with individual package policy.
This commit is contained in:
parent
6d12549b18
commit
3dbad22900
|
@ -41,7 +41,8 @@ var (
|
|||
input = flag.String("input", "spec.json", "Input JSON-LD specification used to generate Go code.")
|
||||
vocabName = flag.String("vocab", "ActivityStreams", "The vocabulary name being generated by 'input'.")
|
||||
// TODO: Be more rigorous when applying this. Also, clear the default value I am using for convenience.
|
||||
prefix = flag.String("prefix", "github.com/cjslep/activity/tools/exp/tmp", "Package prefix to use for all generated package paths. This should be the prefix in the GOPATH directory if generating in a subdirectory.")
|
||||
prefix = flag.String("prefix", "github.com/cjslep/activity/tools/exp/tmp", "Package prefix to use for all generated package paths. This should be the prefix in the GOPATH directory if generating in a subdirectory.")
|
||||
individual = flag.Bool("individual", false, "Whether to generate types and properties in individual packages.")
|
||||
)
|
||||
|
||||
type list []string
|
||||
|
@ -73,12 +74,16 @@ func main() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
policy := convert.FlatUnderRoot
|
||||
if *individual {
|
||||
policy = convert.IndividualUnderRoot
|
||||
}
|
||||
c := &convert.Converter{
|
||||
Registry: registry,
|
||||
GenRoot: props.NewPackageManager(*prefix, "gen"),
|
||||
VocabularyName: *vocabName,
|
||||
ValueRoot: props.NewPackageManager(*prefix, "gen/vals"),
|
||||
PackagePolicy: convert.FlatUnderRoot,
|
||||
PackagePolicy: policy,
|
||||
}
|
||||
f, err := c.Convert(p)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue