A CLI frontend for your bash scripts, focused on ergonomics.
lk
searches for scripts, parses them and finds bash functions. It can then either:
fzf
's ctrl-r
feature. lk
's list mode works like this:
lk'
s fuzzy mode works like this:
I use both modes, but I default to fuzzy. You can change the default like this:
lk
finds executable non-binary files in the current directory and any sub-directorylk
finds and displays comment headers from your scripts lk
finds and displays comments for functionslk
ignores functions prefixed with _
. lk
uses a temporary file to execute the script, but you shouldn't need to worry about thatlk
will write the command you execute to your historyFrom 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.
make
and PHONY
to do non-compile stuff to your project. You are like little baby to me. Just write bash and let lk
handle the exploration and execution..env
files.lk my_service jfdi
.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!" } ```
There's no configuration file for lk
, but it does store logs in ${HOME}/.config/lk
.
If you have any typist home key dicipline and if you flap your right hand at the keyboard there's a good chance you'll type 'lk'. So it's short, and ergonomic.
lk --fuzzy
~/.config/lk/lk.toml
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.