diff options
Diffstat (limited to 'cmd/binapi-generator/main.go')
-rw-r--r-- | cmd/binapi-generator/main.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/cmd/binapi-generator/main.go b/cmd/binapi-generator/main.go index b3a131c..faed54f 100644 --- a/cmd/binapi-generator/main.go +++ b/cmd/binapi-generator/main.go @@ -30,15 +30,18 @@ import ( ) var ( - inputFile = flag.String("input-file", "", "Input file with VPP API in JSON format.") - inputDir = flag.String("input-dir", ".", "Input directory with VPP API files in JSON format.") - outputDir = flag.String("output-dir", ".", "Output directory where package folders will be generated.") - includeAPIVer = flag.Bool("include-apiver", false, "Include APIVersion constant for each module.") - includeComments = flag.Bool("include-comments", false, "Include JSON API source in comments for each object.") - continueOnError = flag.Bool("continue-onerror", false, "Continue with next file on error.") - debug = flag.Bool("debug", false, "Enable debug mode.") + inputFile = flag.String("input-file", "", "Input file with VPP API in JSON format.") + inputDir = flag.String("input-dir", ".", "Input directory with VPP API files in JSON format.") + outputDir = flag.String("output-dir", ".", "Output directory where package folders will be generated.") + includeAPIVer = flag.Bool("include-apiver", false, "Include APIVersion constant for each module.") + includeComments = flag.Bool("include-comments", false, "Include JSON API source in comments for each object.") + includeBinapiNames = flag.Bool("include-binapi-names", false, "Include binary API names in struct tag.") + continueOnError = flag.Bool("continue-onerror", false, "Continue with next file on error.") + debug = flag.Bool("debug", debugMode, "Enable debug mode.") ) +var debugMode = os.Getenv("DEBUG_BINAPI_GENERATOR") != "" + var log = logrus.Logger{ Level: logrus.InfoLevel, Formatter: &logrus.TextFormatter{}, @@ -107,6 +110,7 @@ func generateFromFile(inputFile, outputDir string) error { ctx.includeAPIVersionCrc = *includeAPIVer ctx.includeComments = *includeComments + ctx.includeBinapiNames = *includeBinapiNames // read input file contents ctx.inputData, err = readFile(inputFile) |