init repo

This commit is contained in:
b1ek 2024-06-04 00:16:30 +10:00
commit e191afbf1f
Signed by: blek
GPG Key ID: 14546221E3595D0C
9 changed files with 246 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
public
.DS_Store

18
config.toml Normal file
View File

@ -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

38
content/_index.md Normal file
View File

@ -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`

55
content/manual.md Normal file
View File

@ -0,0 +1,55 @@
+++
+++
<div class='warn'>
<div class='icon'></div>
<p>
these instructions are suited for UNIX systems.<br/>
if you are on windows, idk good luck i guess
</p>
</div>
# 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`

69
sass/style.scss Normal file
View File

@ -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
}
}

BIN
static/warn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

19
templates/base.html Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<meta charset="utf8">
<head>
<title>bshchk</title>
<link href="/style.css" rel="stylesheet">
</head>
<body>
<h1 style="margin-bottom:0;padding-bottom:0">bshchk</h1>
<p style="margin:0;padding:0;padding-bottom:1em;line-height:0">
<a href="/">home</a>
|
<a href="/manual">manual</a>
</p>
<p style="margin-top:0;padding-top:0">bshchk - a dependency checker for bash scripts</p>
{% block content %}{% endblock %}
</body>
</html>

7
templates/index.html Normal file
View File

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block content %}
{{ section.content | safe }}
{% endblock content %}

38
templates/page.html Normal file
View File

@ -0,0 +1,38 @@
{% extends "base.html" %}
{% block content %}
{% if page.toc %}
<h2>table of contents</h2>
<ul>
{% for h1 in page.toc %}
<li>
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
{% if h1.children %}
<ul>
{% for h2 in h1.children %}
<li>
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
{% if h2.children %}
<ul>
{% for h3 in h2.children %}
<li>
<a href="{{ h3.permalink | safe }}">{{ h3.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
<hr/>
{% endif %}
{{ page.content | safe }}
{% endblock content %}