From e191afbf1f81c1e90177ad6cfa42255c0003c923 Mon Sep 17 00:00:00 2001 From: b1ek Date: Tue, 4 Jun 2024 00:16:30 +1000 Subject: [PATCH] init repo --- .gitignore | 2 ++ config.toml | 18 +++++++++++ content/_index.md | 38 ++++++++++++++++++++++++ content/manual.md | 55 ++++++++++++++++++++++++++++++++++ sass/style.scss | 69 +++++++++++++++++++++++++++++++++++++++++++ static/warn.png | Bin 0 -> 541 bytes templates/base.html | 19 ++++++++++++ templates/index.html | 7 +++++ templates/page.html | 38 ++++++++++++++++++++++++ 9 files changed, 246 insertions(+) create mode 100644 .gitignore create mode 100644 config.toml create mode 100644 content/_index.md create mode 100644 content/manual.md create mode 100644 sass/style.scss create mode 100644 static/warn.png create mode 100644 templates/base.html create mode 100644 templates/index.html create mode 100644 templates/page.html 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 0000000000000000000000000000000000000000..d41afcfce7f7e7e434c6f02b8efa2e4cd20e283c GIT binary patch literal 541 zcmV+&0^1X%W3@ z63c=m%Y!A*j54rW4zXMg(2O#>awoiVCz(nOnM)3kMGloq6951J0002$wO`hI3H z=(Jk@@2bsk2L9`rd3t&0vs3@*jd5~u=dw}IgdzXsf&bDnhzZv9rwRc=B-S`elYgKXYZ046B84|d@ty+Vf4Ul=B{3YHUaWZNU{I` z03mczPE!CQ`TNH++D%C5=WA#3h=T_B_n?>({QC^JvHbh{_8BwS3o1bX005~;L_t&- z(_>%&14brhMh0ZSqNvD%%x6_nR#sv~5@1tNRaId_@Y&VWH8j-KIN$=Dnp)c0S~^@X zKDVx(zJY)XdD(#GDtx=d-Z1va+_eva+<{2k`|2ZSCys9UScK9i4;( zfC9qKF0N4E;wHktAS&kW;pyq= + + + + 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