Skip to content
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

4.0: Rethinking CLI-based configuration #94

Closed
about-code opened this issue May 30, 2020 · 0 comments
Closed

4.0: Rethinking CLI-based configuration #94

about-code opened this issue May 30, 2020 · 0 comments
Milestone

Comments

@about-code
Copy link
Owner

about-code commented May 30, 2020

The configuration schema grew complex and mapping it to individual CLI arguments makes the CLI difficult to understand and use. Rather than trying to map a complex configuration schema to command line options an easier interface were to provide only two options for merging a JSON string configuration with a file configuration:

For example:

glossarify-md 
  --config "./glossarify-md.conf.json"
  --shallow "{ 'glossaries': [{ 'termHint': '='}] }"

replaces the a glossaries: [...] array in the configuration file for that particular execution

glossarify-md 
  --config "./glossarify-md.conf.json"
  --deep "{ 'glossaries': [{ 'file': './glossary2.md', 'termHint': '+'}] }"

adds a new entry to glossaries: [...] array in the configuration file for that particular execution.

@about-code about-code added this to the v4.0.0 milestone May 30, 2020
about-code added a commit that referenced this issue May 30, 2020
BREAKING CHANGE: Command Line Interface (CLI) changed (#94).
From the old set of arguments only `--config` and `--help` remain supported.
`--config` is now *required*. Any other configuration options are being
replaced by two new options `--shallow` and `--deep` which take a JSON
string that is expected to match the configuration schema. As you may
suggest from their names you can use them to merge a command-line provided
configuration with the configuration provided in the configuration file.

Use those two options if you need to override particular configuration
keys in a configuration file on a particular program execution.

For example if you previously wrote

~~~
glossarify-md --config ./glossarify-md.conf.json --baseUrl "http://example.org"
~~~

you now write

~~~
glossarify-md --config ./glossarify-md.conf.json --shallow '{ "baseUrl": "http://example.org" }'
~~~

If you need to add another glossarify file write

~~~
glossarify-md --config ./glossarify-md.conf.json --deep '{ "glossaries": [{ "file": "./glossary2.md" }] }'
~~~

Closes #93 and #94.
about-code added a commit that referenced this issue Aug 11, 2020
BREAKING CHANGE: Command Line Interface (CLI) changed (#94).
From the old set of arguments only `--config` and `--help` remain supported.
`--config` is now *required*. Any other configuration options are being
replaced by two new options `--shallow` and `--deep` which take a JSON
string that is expected to match the configuration schema. As you may
suggest from their names you can use them to merge a command-line provided
configuration with the configuration provided in the configuration file.

Use those two options if you need to override particular configuration
keys in a configuration file on a particular program execution.

For example if you previously wrote

~~~
glossarify-md --config ./glossarify-md.conf.json --baseUrl "http://example.org"
~~~

you now write

~~~
glossarify-md --config ./glossarify-md.conf.json --shallow '{ "baseUrl": "http://example.org" }'
~~~

If you need to add another glossarify file write

~~~
glossarify-md --config ./glossarify-md.conf.json --deep '{ "glossaries": [{ "file": "./glossary2.md" }] }'
~~~

Closes #93 and #94.
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

No branches or pull requests

1 participant