From 23a8c12bca35485a1248169af0d2193433137e1c Mon Sep 17 00:00:00 2001 From: zawz Date: Sat, 14 Aug 2021 13:52:01 +0200 Subject: [PATCH] update doc with new features --- README.md | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 610540d..b660059 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,13 @@ wget -qO- https://zpkg.zawz.net/install.sh | sh zpkg install lxsh ``` -### Binary +### Binary amd64 -Download the `lxsh.tar.gz` archive, extract it, +Download the `lxsh-linux-amd64.tar.gz` archive, extract it, and move the `lxsh` binary in a PATH folder (`/usr/local/bin` is the recommended). ```shell -wget https://github.com/zawwz/lxsh/releases/download/v1.2.0/lxsh-linux-amd64.tar.gz +wget https://github.com/zawwz/lxsh/releases/download/v1.3.0/lxsh-linux-amd64.tar.gz tar -xvf lxsh-linux-amd64.tar.gz sudo mv lxsh /usr/local/bin ``` @@ -45,6 +45,19 @@ These commands can be placed anywhere within the script like regular commands. Reduce code size to a minimum without changing functionality with the `-m` option. + +#### Behaviors of the minify option + +- removes any unnecessary separator character between arguments/commands +- removes `;;` from the last value in a case +- removes unnecessary quotes on arguments +- transforms unnecessary manipulations (e.g. `${VAR}`) into simple variable call +- Brace blocks or subshells with a single command will be replaced by said command + +> These features only apply if they won't change behavior, for instance +removal of an unnecessary manipulation will not be made if the following character +could expand the variable name + ### Further minifying The script can be further minified by altering code elements. @@ -56,8 +69,6 @@ use `--exclude-var` to exclude variables from being minified (for example enviro Function names can be minified with `--minify-fct`, use `--exclude-fct` to exclude functions from being minified. -Unnecessary quotes can be removed with `--minify-quotes`. - Unused functions and variables can be removed with `--remove-unused`. Use `-M` to enable all of these minifying features (you still have to specify `--exclude` options when needed) @@ -73,6 +84,9 @@ The following bash features can be debashified: - `[[ ]]` conditions - indexed arrays and associative arrays (+ their `declare` and `typeset` definitions) - `$RANDOM` +- substring variable manipulation (`${VAR:N:M}`) +- variable substitution (`${!VAR}`) +- search replace manipulation (`${VAR/s/a/b}` ) ### Advantages @@ -122,6 +136,10 @@ these features will continue working with undesired behavior. Array argument with `[@]` does not expand into the desired multiple arguments. +#### Substring manipulation + +Debashifying a substring manipulation on a variable containing a newline will not work correctly + ## Extension commands If you use the `#!/usr/bin/lxsh` shebang, you can use special lxsh-defined commands.