I don't like longer commands. So I often use
Just like following:
$ alias d=docker $ d ps # `docker ps`
Infrequently, we want to use
alias to sub-command.
alias command can apply for command only.
salias means sub-alias.
salias makes it possible to apply alias to sub-commands.
[go] i = "install" b = "build" r = "run" [docker] i = "image" c = "container" [docker-compose] l = "logs -f"
$ go i github.com/golang/go # `go install github.com/golang/go` $ docker i ls # `docker image ls` $ alias d=docker $ d c ls # `docker container ls`
- Go v1.8 or newer
- bash, Zsh or fish
$ go get github.com/lycoris0731/salias
Set sub-alias definition file
Please set the file to one of following.
Add following command.
source <(salias __init__)
source (salias __init__ | psub)
How It Works
salias registers the command as salias's alias.
# [go] # b = "build" $ source <(salias __init__) $ type go go is an alias for salias go
salias find sub-alias that is sub-command of passed command as arguments.
If hit sub-alias, execute it.
Or not found, execute as it is.
Please see LICENSE.