A CLI frontend for your bash scripts, focused on ergonomics.
lk parses scripts and finds bash functions. It can then either:
* pretty prints the functions it finds so you can run them through lk, rather like sub commands in git.
* let you fuzzy find and execute functions, similar to the wonderful fzf's ctrl-r feature.
Say you have a script called script.sh that looks like this:
```
some_function() { echo "hello world from a script" echo "foobar" sleep 1 echo "ending function now" }
yetmorefunctions() { echo "hello from another function" } ```
You can access it by executing lk, and it'll find the script and show you what functions are available. Then you can run something like this to execute the function:
bash
lk script.sh some_function
Or, with the new fuzzy find feature, you can search for scripts. Run lk --fuzzy and you'll see a searchable list, like this:

From the crate:
bash
cargo install lk
bash
cargo install --force lk
Just execute lk and follow the instructions. lk --help is also a thing you can run.
Big design goal: you shouldn't have to. But there are many styles of bash, and if lk doesn't work with how you write your bash then please let me know and I'll be all over fixing it.
Having said that lk does support comments. lk will extract comments from file and function headers, if it finds any, and display them alongside all your runnable functions. At the moment it relies on these comments following the form in the Google Shell Style Guide. I.e. like this:
```bash
#
be_glorious() { echo "Ta da!" } ```
lk will extract comments in the file header, if it finds any, and display them alongside all your runnable functions. ,i.e. like this:
bash
There's no configuration file for lk, but it does store logs in ${HOME}/.config/lk.
This is a tool that I use a lot, and "lk" is short and ergonomic. As long as you're reasting on the home keys.
lk --fuzzy exclusively, as I expect, I'll need to add some way to configure this as a default. That'd make it more useful out-of-the-box.I have previously written two similar tools: * run_lib - my first draft and written in bash * runsh - my second draft and written in Rust
run_lib still has its uses. I've worked in secure environments where I could not have installed a binary. run_lib is just a bash script.
fzf is wonderful. The --fuzzy option in lk comes from years of ctrl-r fuzzy finding through my shell history with fzf. I almost didn't implement this feature because I thought "why bother? fzf has already done it perfectly." Or rather I thought about piping from lk to fzf. But having the functionality implemented natively is the right thing for lk. But you'll notice, perhaps, that the rendering of the fuzzy search in lk draws a lot of visual inspiration from fzf. fzf, I love you.