Closed mackoj closed 3 years ago
My bad it's possible to handle option
Just need to change option
to this.
@Option(name: .shortAndLong, parsing: ArrayParsingStrategy.singleValue, help: "An option that will be merged with template options, and overwrite any options of the same name.\nCan be repeated multiple times and must be in the format --option \"name:value\".\nThe key can have multiple parts separated by dots to set nested properties:\nfor example, --option \"typeAliases.ID:String\" would change the type alias of ID to String.", transform: { $0 })
var option: [String]
swaggen generate --help
USAGE: swaggen generate [--option <option> ...] [--clean <clean>] [--template <template>] [--destination <destination>] [--language <language>] [--silent] [--verbose]
OPTIONS:
-v, --version Prints the current version of this app.
-o, --option <option> An option that will be merged with template options, and overwrite any options of the same name.
Can be repeated multiple times and must be in the format --option "name:value".
The key can have multiple parts separated by dots to set nested properties:
for example, --option "typeAliases.ID:String" would change the type alias of ID to String.
-c, --clean <clean> How the destination directory will be cleaned of non generated files:
none: no files will be removed
leave.files: all other files will be removed except if starting with . in the destination directory
all: all other files will be removed
(default: all other files will be removed)
-t, --template <template>
Path to the template config yaml file. If no template is passed a default template for the language will be used.
-d, --destination <destination>
The directory where the generated files will be created. (default: generated)
-l, --language <language>
The language of the template that will be generated. (default: swift)
--silent Silence standard output
--verbose Show verbose output
-h, --help Show help information.
I just put a PR up to update SwiftCLI https://github.com/yonaskolb/SwagGen/pull/241
The latest version has similar property wrapper support. You might have other motivations to change though 🤷♂
My motivation was to reducing 3rd party dependencies.
Since Argument Parser is made by Apple it will be used by more app and be more stable and feature full and more known than 3rd party solutions. And 3rd party solution tend to decline when a first party solution is available.
This issue is more an open question on this subject.
I don't know if it's needed but we could in the future move to ArgumentParser.
Implementation
Output of help
Output of help for generate