Skip to content

Generate command models from argument parser info JSON files #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

cmcgee1024
Copy link
Member

@cmcgee1024 cmcgee1024 commented May 7, 2025

Instead of hand-crafting the helper functions, options, and structs for each command,
describe the command structure using an argument parser compatible JSON format
for each command. Introduce a generator tool that generates all of the Swift types in
a manner that is similar to the way that they were hand-written before.

There are certain limitations in the JSON schema for the Swift argument parser that
prevent the generator from knowing certain important details. For example, there is
no information on which arguments contain file paths, which is important information
for type safety in this context. For this information, and more potentially in the future
introduce a "-ext.json" file with an extension schema to hold the extra information.

TODO:

  • Move the core of the generator into SwiftlyCore alongside the runtime
  • Remove the ext.json single dash long options in favour of the supports that already exists in argument parser's schema

@cmcgee1024
Copy link
Member Author

@swift-ci test macOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant