# ltsh
**(highly experimental)**
tiny utility program for type-analysis of shell pipelines based on ladder-typing
### Example
```sh
[~]$ ltsh <<< 'echo -n $PATH | xargs stat -c %Y | sort -n'
```
```
--- BEGIN TYPE-ANALYSIS ---
* unknown stdin-type of `echo -n $PATH`
* typecheck error
echo -n $PATH | xargs stat -c %Y
|
> | >
>> | >>
> | >
> | >
|
|
* typecheck ok
xargs stat -c %Y | sort -n
|
> |
> |
|
> | >
>> | >>
> | >
|
|
--- END TYPE-ANALYSIS ---
```
### Install
```sh
git clone https://github.com/michaelsippel/ltsh
cd ltsh
cargo install --path .
```
### Use as Zsh-Extension
To automatically check every pipeline entered during interactive shell
use, add the following hook to your `.zshrc`:
```sh
preexec() {
if ! ltsh <<< "${1}";
then
echo "\e[33;1m"
echo "!! ltsh discoverd a type incompatibility. !!"
echo "!! abort [CTRL-C] or continue regardless [RET] !!"
echo "\e[0m"
read -s keys
fi
}
```
## Limitations
* only parses pipelines
* ignores quoting rules & expansions
* regex-based typedb implementation (slow & incapable)
## License
[GPLv3](COPYING)