Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Allow parameters to be specified through configuration file #74

Open
@mattt

Description

@mattt

As we begin to add (#65) and consider (#57, #72) new options for the generate command, I think it's likely that the number of options for the generate command will soon exceed what can be reasonably expressed through command-line arguments alone.

Maybe this isn't inevitable. If we took seriously the canon of parsimony in our API design, perhaps we'd find that a small, fixed set of parameters are all that are necessary. This could all be a trap, a slippery slope that projects fall into all too frequently in a rush to add functionality. I'd love to be hear better arguments about limiting feature creep.

But from where I am right now, it's hard to look at, say, the configuration options for jazzy or other comparable tools and think that we'll find a way to solve the same problem without a similar number of settings. Taken altogether in aggregate, you start to get the sense about the inherent complexity of the problem.

So, assuming this is indeed something we'll need, it's probably something we should figure out before 1.0.0. Here's what I'm thinking:

  • Extend ArgumentParser to make options Codable. Unless this already exists, this is something that would be useful beyond swift-doc and a good candidate for an upstream patch or separate library.
  • By default, look for a .swift-doc.json (spelling?) file and read those as a base configuration, and add an option for where to look for a configuration file.
  • Options in the configuration file override the default values. Any options passed from the command line to the executable override ones from a configuration file (similar to how most systems work, including UserDefaults).
  • We should also think about versioning and validation for these files, as well as documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions