Added option to disable XML fields/import when using Go#60
Open
SaschaMendel wants to merge 1 commit intoxuri:masterfrom
Open
Added option to disable XML fields/import when using Go#60SaschaMendel wants to merge 1 commit intoxuri:masterfrom
SaschaMendel wants to merge 1 commit intoxuri:masterfrom
Conversation
xuri
requested changes
Nov 6, 2022
Owner
xuri
left a comment
There was a problem hiding this comment.
Thanks for your PR. I've left some comments.
| flag.Parse() | ||
| if *helpPtr { | ||
| fmt.Printf("xgen version: %s\r\nCopyright (c) 2020 - 2021 Ri Xu https://xuri.me All rights reserved.\r\n\r\nUsage:\r\n$ xgen [<flag> ...] <XSD file or directory> ...\n -i <path>\tInput file path or directory for the XML schema definition\r\n -o <path>\tOutput file path or directory for the generated code\r\n -p \tSpecify the package name\r\n -l \tSpecify the language of generated code (Go/C/Java/Rust/TypeScript)\r\n -h \tOutput this help and exit\r\n -v \tOutput version and exit\r\n", Cfg.Version) | ||
| fmt.Printf("xgen version: %s\r\nCopyright (c) 2020 - 2021 Ri Xu https://xuri.me All rights reserved.\r\n\r\nUsage:\r\n$ xgen [<flag> ...] <XSD file or directory> ...\n -i <path>\tInput file path or directory for the XML schema definition\r\n -o <path>\tOutput file path or directory for the generated code\r\n -p \tSpecify the package name\r\n -l \tSpecify the language of generated code (Go/C/Java/Rust/TypeScript)\r\n --noxml \tDon't generate XMLName fields on structs (Go)\r\n -h \tOutput this help and exit\r\n -v \tOutput version and exit\r\n", Cfg.Version) |
Owner
There was a problem hiding this comment.
The doc in the README.md also needs to update.
| func parseFlags() *Config { | ||
| iPtr := flag.String("i", "", "Input file path or directory for the XML schema definition") | ||
| oPtr := flag.String("o", "xgen_out", "Output file path or directory for the generated code") | ||
| noXmlName := flag.Bool("noxml", false, "Don't add xmlName fields") |
Owner
There was a problem hiding this comment.
I suggest that using the --skip-go-xml-name instead of noxml, will be more clear.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Generated structs are given an XMLName field + encoding/xml import.
Sometimes you may not want this, for example when using an XSD just to generate structs for some other application than XML-parsing.
This feature adds a commandline option to omit those fields:
Types of changes