Typical usage#
go to some directory use short alias#
> pwd
/home/jw
> go prj0
cd /work/projects/design/master-branch/
> pwd
/work/projects/design/master-branch/run a serial of commands use short alias#
> run vnc
ssh -L 5901:remote-internal-server-name:5901 jw@remote-gateway-ip
vncviewer remote-internal-server-nameSearch available alias#
Here . dot is used to replace * star because zsh will try to expand * by default.
> go
prj0
> go p.
prj0
> run
vncAuto-correction#
shortcut.py uses difflib.get_close_matches to auto-correct the alias.
Configuration files#
- Location
~/.shortcut/
- Naming conventions
- Ex.
go.cfgforgocommand andrun.cfgforruncommand
- Ex.
- Format
// comments
// filename: ~/.shortcut/go.cfg
# prj0
cd /work/projects/design/master-branch/// filename: ~/.shortcut/run.cfg
# vnc
ssh -L 5901:remote-internal-server-name:5901 jw@remote-gateway-ip
vncviewer remote-internal-server-nameHow-to#
- Download shortcut.py to
~/script/shortcut.py - Create your own
~/.shortcut/*.cfgfile - Add the following lines into your
.zshrc
shortcut () {
local cmd
cmd=$(python3 ~/script/shortcut.py $@)
eval ${cmd}
}
alias go=`shortcut go`
alias run=`shortcut run`