Map CLI option to add an extension
Spun off from #799 (closed), map a CLI option to the new playbook key for extensions to allow extensions to be added from the CLI. The proposed option is --extension
. This option can be specified multiple times. Extensions specified using the CLI option should be additive. In other words, they contribute additional extensions to the list specified in the playbook file.
Since extensions may take configuration options, we need a way for the user to specify these options while still being able to add extensions from the CLI. For this, I propose allowing extensions to be configured in the playbook file, but marked as not enabled. They can then be enabled using the CLI option. The extension specified via the CLI is correlated with the extension in the playbook file through the use of the reserved id
key.
Here's how it would work:
pipeline:
extensions:
- id: lunr
require: antora-lunr
enabled: false
languages: en,fr
Then this extension can be enabled via the CLI by referencing the ID in the value of the --extension
option:
antora --extension=lunr antora-playbook.yml
If an ID cannot be matched, then the value is assumed to be a require request (i.e., the value of the require
key).
In the future, we might consider the possibility of allowing configuration options to be embedded in the value of the --extension
option (e.g., --extension="antora-lunr;languages=en,fr"
), but that's beyond the scope of this issue.