This repository was archived by the owner on Sep 2, 2021. It is now read-only.
Executing a command and retrieving its result with !(EXEC cmd) syntax #80
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.
Hello,
For my personal needs I implemented a new feature:
!(EXEC cmd)to execute a command (with shell) and replace the syntax by its result.This can be useful for automating the generation of a Markdown file, for instance inserting the current date (or, say, a version number):
Project version: !{EXEC bash -c "./get_version.sh"}Date of today: !(EXEC date)It is also possible to escape it; that's how the
readme.mdppis able to process correctly\!(EXEC This will not execute)If there are parenthesis/braces/brackets in the EXEC command, right now it will pose issues because I implemented it using a simple regexp (one would require a grammar to take care of matching parenthesis).
The workaround is to use different delimiters ; there are three available, parenthesis, brackets and braces
\![EXEC echo "A command with different delimitors"]By using the PR #79 I was able to pass all tests, except one (
exec_file) which required to correct a minor bug (see commit 23c23f1)I'm open to any change