Hopefully a way to make small scripts easier to share/discover. It was inspired by this blog post, with a few important upgrades
If a script has a sibling with the same name and a .help
extension.
The help file will be read as text and the contents written as a help
message for tab completion
docker exec important-container | xargs oh-wow-i-wanna-remember-this | awk "?"
>>> ...output
s new misc impt-dcker-cmd -- !:q
new
will accept everything after --
as the script body. And !:q
will perfectly quote the previous command so it is not executed, but
passed to new
s meta last-invoked
s meta last-completed
s meta has-never-run
s meta dangling-docs
shows.help
files without a script
- put the main
s
script somewhere in yourPATH
and make it executable - Put the completion script
_s
… somewhere. <a href=”*how to setup shell completion”>Read below
- jq
- yq
- fd
- rg
- fzf
- sd
- grpcurl
- moreutils # (vipe, sponge)
shell completion provides most of the benefit of using this, and it can be a little tricky to setup correctly.
- Copy zsh-completions/_cbisd to /usr/share/zsh/vendor-completions/_cbisd
- In your zsh config, set the following before zsh runs
compinit
(which means just put it at the top of your.zshrc
)
fpath=($fpath /usr/share/zsh/vendor-completions)
- After making the above change to .zshrc, open a new shell. And
run
rm -f ~/.zcompdump; compinit
- To test that it worked correctly, run
cat ~/.zcompdump | grep _cbisd
, you should be all set if that exits 0
Run the below w/in litecli $SCRIPTS_LOCAL_DIR/s-scripts-meta.db
CREATE TABLE invocations(
ID INTEGER PRIMARY KEY,
command TEXT,
args TEXT,
ts DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE executions(
ID INTEGER PRIMARY KEY,
command TEXT,
args TEXT,
ts DATETIME DEFAULT CURRENT_TIMESTAMP
);