mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-02-12 07:09:13 +01:00
Updated documentation and added new prettybat formatter
This commit is contained in:
parent
5f248064e0
commit
0b04dfa5f4
@ -40,7 +40,8 @@ There are three different options for minification:
|
||||
| `--minify=lib` | Embedded library scripts will be minified. [default] |
|
||||
| `--minify=all` | Everything will be minified. |
|
||||
|
||||
This uses [bash_minifier](https://github.com/precious/bash_minifier) to perform minification, and requires Python 2 to be installed as either `python2` or `python`.
|
||||
This uses [shfmt](https://github.com/mvdan/sh) to perform minification.
|
||||
|
||||
|
||||
|
||||
|
||||
|
18
build.sh
18
build.sh
@ -6,7 +6,6 @@
|
||||
# Issues: https://github.com/eth-p/bat-extras/issues
|
||||
# -----------------------------------------------------------------------------
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
DL="$HERE/.download"
|
||||
BIN="$HERE/bin"
|
||||
SRC="$HERE/src"
|
||||
LIB="$HERE/lib"
|
||||
@ -162,13 +161,7 @@ pp_strip_comments() {
|
||||
# Minify a Bash source file.
|
||||
# https://github.com/precious/bash_minifier
|
||||
pp_minify() {
|
||||
local python="python"
|
||||
if command -v python2 &>/dev/null; then
|
||||
python="python2"
|
||||
fi
|
||||
|
||||
"$python" "$DL/minifier.py"
|
||||
printf "\n"
|
||||
shfmt -mn
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
@ -196,14 +189,13 @@ else
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Download resources.
|
||||
# Check for resources.
|
||||
|
||||
[[ -d "$DL" ]] || mkdir "$DL"
|
||||
[[ -d "$BIN" ]] || mkdir "$BIN"
|
||||
|
||||
if [[ "$OPT_MINIFY" != "none" ]] && ! [[ -f "$DL/minifier.py" ]]; then
|
||||
printc "%{YELLOW}Downloading %{BLUE}https://github.com/precious/bash_minifier%{YELLOW}...%{CLEAR}\n" 1>&2
|
||||
curl -sL "https://gitcdn.xyz/repo/precious/bash_minifier/master/minifier.py" > "$DL/minifier.py"
|
||||
if [[ "$OPT_MINIFY" != "none" ]] && ! command -v shfmt &>/dev/null; then
|
||||
printc "%{RED}Warning: cannot find shfmt. Unable to minify scripts.%{CLEAR}\n"
|
||||
OPT_MINIFY=none
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -30,6 +30,7 @@ See `man bat` for more information.
|
||||
| YAML | [prettier](https://prettier.io/) |
|
||||
| HTML | [prettier](https://prettier.io/) |
|
||||
| Rust | [rustfmt](https://github.com/rust-lang/rustfmt) |
|
||||
| Bash | [shfmt](https://github.com/mvdan/sh) |
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user