commit e191afbf1f81c1e90177ad6cfa42255c0003c923 Author: b1ek Date: Tue Jun 4 00:16:30 2024 +1000 init repo diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a7cea66 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +public +.DS_Store diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..8160283 --- /dev/null +++ b/config.toml @@ -0,0 +1,18 @@ +# The URL the site will be built for +base_url = "https://bshchk.blek.codes" + +# Whether to automatically compile all Sass files in the sass directory +compile_sass = true + +# Whether to build a search index to be used later on by a JavaScript library +build_search_index = false + +[markdown] +# Whether to do syntax highlighting +# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola +highlight_code = true + +minify_html = true + +[extra] +# Put all your custom variables here diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..2ad21d9 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,38 @@ ++++ ++++ + +## why? +lets take this script: + +```bash +rm -fr data.json +curl https://url.com/data.json -o data.json +``` + +the problem here is that `curl` might not be installed on second line, but the data is already deleted. + +it will result in `data.json` being irreparably deleted and no way to reinstall it + +## solution +you could write up something like this and put it in the start: + +```sh +if ! command -v curl; then + echo no curl! + exit 1 +fi +``` + +but that's just not reliable and barely maintainable. so that's why i made this thing. + +you can use it like this: + +```sh +# program.sh +#!/usr/bin/env bash +curl https://url.com +``` + +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` diff --git a/content/manual.md b/content/manual.md new file mode 100644 index 0000000..883c968 --- /dev/null +++ b/content/manual.md @@ -0,0 +1,55 @@ ++++ ++++ + +
+
+

+ these instructions are suited for UNIX systems.
+ if you are on windows, idk good luck i guess +

+
+ +# getting started +## installation +there are a few ways: + +1. manually, from a git repo + + first, clone the damn thing: `git clone https://git.blek.codes/blek/bshchk.git` + + then `cd` to that directory and compile it with `build.sh`. copy the binary to one of your `$PATH` directories + +2. from a package manager + + `bshchk` is not currently available on any package manager + +## usage +`bshchk` supports the following comment tags: + +```sh +# to add one or a bunch of CMDs to dependencies +#bshchk:add-cmd cmd1 cmd2 +#bshchk:add-cmd cmd + +# to exclude one or a bunch of CMDs from dependencies +#bshchk:ignore-cmd cmd1 cmd2 +#bshchk:ignore-cmd cmd +``` + +also, `bshchk` requires for the script to have `#!/bin/bash` or `#!/usr/bin/env bash` as the first line. + +if you really need, there is a CLI Option `--ignore-shebang` to ignore an invalid shebang, although it is not recommended. + +## CLI options + +### --yield-deps-only +will print the dependencies as a JSON array, like this: `["one", "two", "three"]`. would be useful when you want to handle the dependencies yourself + +### --expose-deps +add this flag to add `deps` variable to your script with an array of dependencies + +### --deps-var-name +change the `deps` variable name to your liking + +### --ignore-shebang +(not recommended) if you want to use any other shebang than `#!/bin/bash` or `#!/usr/bin/env bash` \ No newline at end of file diff --git a/sass/style.scss b/sass/style.scss new file mode 100644 index 0000000..e202293 --- /dev/null +++ b/sass/style.scss @@ -0,0 +1,69 @@ +html, body { + font-family: monospace; + @media (prefers-color-scheme: dark) { + background: #1b1b1b; + color: #e1ebe1; + } +} +body { + margin-bottom: 50px; +} + +pre { + padding: 1em; + width: fit-content; +} + +p code { + padding: 0.1em 0.4em; +} + +pre, p code { + border-radius: 0.3em; + border: 1px solid #3b404b; +} +p code { + border-color: #3b404b10; + border-radius: 0; + @media (prefers-color-scheme: dark) { + border-color: #c4bfb415; + } +} + +pre.language-txt { + width: calc(100% - 2.3em); + height: 100%; +} + +.warn { + border: 1px solid goldenrod; + border-radius: 0.5em; + padding: 1em; + width: fit-content; + display: flex; + flex-direction: row; + justify-items: center; + align-items: center; + height: 100%; + .icon { + display: block; + content: ''; + background-image: url('/warn.png'); + width: 16px; height: 16px; + margin-right: 0.8em; + } + p { + padding: 0; margin: 0; + } + @media (prefers-color-scheme: dark) { + border-color: #885600; + } +} + + + +@media (prefers-color-scheme: dark) { + a { + color: #3391ff + } +} \ No newline at end of file diff --git a/static/warn.png b/static/warn.png new file mode 100644 index 0000000..d41afcf Binary files /dev/null and b/static/warn.png differ diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..594eaf2 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,19 @@ + + + + + bshchk + + + + +

bshchk

+

+ home + | + manual +

+

bshchk - a dependency checker for bash scripts

+ {% block content %}{% endblock %} + + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..1f7cccc --- /dev/null +++ b/templates/index.html @@ -0,0 +1,7 @@ +{% extends "base.html" %} + +{% block content %} + + {{ section.content | safe }} + +{% endblock content %} \ No newline at end of file diff --git a/templates/page.html b/templates/page.html new file mode 100644 index 0000000..ed1d703 --- /dev/null +++ b/templates/page.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block content %} + + {% if page.toc %} +

table of contents

+ +
+ {% endif %} + + {{ page.content | safe }} + +{% endblock content %} \ No newline at end of file