Skip to content

Enable extraction of markdown code blocks through the bash script

Notifications You must be signed in to change notification settings

BitFis/bash-markdown-code-extractor

Repository files navigation

Bash Scripts

Those scripts should help setting things up and prepare the test environment.

Test Scripts

For script quality, bats was used to test the scripts, it will mock the calls to the actual programs and just tests that the scripts du what they should by checking input and the external calls. Running the test scripts will not change any state on the machine.

To run the test, bats needs to be installed.

git clone https://github.com/sstephenson/bats.git
cd bats
./install.sh /usr/local

Simple Conditionals

Following a cheatsheet of conditionals to help prevent running commands multiple times. Those are valid bash conditions, which are just beeing checked before the actual script is run.

[//]: #conditional (! command -v [command] &> /dev/null)
```bash
# only execute block if [command] does not exist
sudo apt -y install [command]
...
[//]: #conditional ([[ "$OSTYPE" == "linux-gnu" ]])
```bash
# run if OSTYPE is "linux-gnu"
cmake -DLINUX_GNU
...
[//]: #conditional ([[ ! -f [file] ]])
```bash
# only execute block if [file] does not exist
touch file
...

Related projects

  • @mdsh: Enables Multi-Lingual Literate Programming withhin markdown

About

Enable extraction of markdown code blocks through the bash script

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages