Compare commits

..

No commits in common. "26236bf0418b6976b8da6ae41cac991ac607b923" and "e191afbf1f81c1e90177ad6cfa42255c0003c923" have entirely different histories.

3 changed files with 3 additions and 46 deletions

View File

@ -7,13 +7,12 @@ compile_sass = true
# Whether to build a search index to be used later on by a JavaScript library # Whether to build a search index to be used later on by a JavaScript library
build_search_index = false build_search_index = false
minify_html = true
[markdown] [markdown]
# Whether to do syntax highlighting # Whether to do syntax highlighting
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola # Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
highlight_code = true highlight_code = true
minify_html = true
[extra] [extra]
# Put all your custom variables here # Put all your custom variables here

View File

@ -14,8 +14,6 @@ the problem here is that `curl` might not be installed on second line, but the d
it will result in `data.json` being irreparably deleted and no way to reinstall it it will result in `data.json` being irreparably deleted and no way to reinstall it
## solution ## solution
so generally, you would want to check if the dependencies of your bash script are installed, right?
you could write up something like this and put it in the start: you could write up something like this and put it in the start:
```sh ```sh
@ -25,11 +23,12 @@ if ! command -v curl; then
fi fi
``` ```
but that's just not reliable and barely maintainable. so that's why i made this thing. it parses your script, and then appends a small snippet at the earliest place in your program that would check if all deps are installed. but that's just not reliable and barely maintainable. so that's why i made this thing.
you can use it like this: you can use it like this:
```sh ```sh
# program.sh
#!/usr/bin/env bash #!/usr/bin/env bash
curl https://url.com curl https://url.com
``` ```
@ -37,42 +36,3 @@ curl https://url.com
then compile it like that: `bshchk program.sh dist.sh`. then compile it like that: `bshchk program.sh dist.sh`.
also you can read the script from stdin: `cat program.sh | bshchk - dist.sh`, or get the output to stdout: `bshchk program.sh > dist.sh` also you can read the script from stdin: `cat program.sh | bshchk - dist.sh`, or get the output to stdout: `bshchk program.sh > dist.sh`
it would output something like this:
```sh
#!/usr/bin/env bash
# This is the runtime dependency checker
# Please do not remove the following lines.
deps=('curl')
non_ok=()
for d in $deps
do
if ! command -v $d > /dev/null 2>&1; then
non_ok+=$d
fi
done
if (( ${#non_ok[@]} != 0 )); then
>&2 echo "RDC Failed!"
>&2 echo " This program requires these commands:"
>&2 echo " > $deps"
>&2 echo " --- "
>&2 echo " From which, these are missing:"
>&2 echo " > $non_ok"
>&2 echo "Make sure that those are installed and are present in \$PATH."
fi
unset non_ok
unset deps
# Dependencies are OK at this point
curl https://url.com
```
---
[website's source code available here](https://git.blek.codes/blek/bshchk.web)

View File

@ -12,8 +12,6 @@
<a href="/">home</a> <a href="/">home</a>
| |
<a href="/manual">manual</a> <a href="/manual">manual</a>
|
<a href="https://git.blek.codes/blek/bshchk">repo</a>
</p> </p>
<p style="margin-top:0;padding-top:0">bshchk - a dependency checker for bash scripts</p> <p style="margin-top:0;padding-top:0">bshchk - a dependency checker for bash scripts</p>
{% block content %}{% endblock %} {% block content %}{% endblock %}