WIP: Allow user provided arguments to CLI #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey, this is a draft PR to better discuss the implementation details of #64.
Once we have agreed on the rough plan, I will create a new PR (or squash these debug commits) and remove
debug.lua,inspect.luaetc.For now, I have kept everything local to the d2 engine for simplicity.
I have added
TODOcomments to highlight things that are possibly worth discussing.In general, the goal is to support the following four argument types:
--theme=100and the short version-t=100--section=and the short version-s=--bundleand the short version-bPOSARGI propose to prefix these options with
argsorargand simply match everything after it.So for a user:
args--theme=100->--theme=100args-s=->-s=argsPOSARG->POSARGI find this less confusing than prefixing it with
args-where you need---to get a double minus--especiallysince this will be the common case. And if we are not too strict with the pattern, the code could also support flags that start with a
+likearg+plus-opt, though the current CLI tools do not use it.From the implementation viewpoint, the key-value flags can simply be processed by pandoc attributes and the
flags and positional arguments via classes. I have yet to find corner-cases with this approach, though I wouldn't be surprised if there would be issues. In that case, a user would have to fall back to the quarto-style options.
This draft does not contain any global option, as I would like to first check if this is going in the right direction.