#Summary
The alias system allows the user to set shortcurs to goto
commands.
An intentionally side effect is to group all functionality inside
goto
command (and remove label
command).
The user can add an alias:
$ goto alias add label "goto label"
label alias executes "goto label"
$ goto alias add g goto
g alias executes "goto"
Remove an alias:
$ goto alias rm label
label alias was removed.
Update an alias by add it using -u | --update
.
##Persistence
With this system, we need to modify our persistence. Now, .goto
is a folder:
.goto/
├─ labels
└─ aliases/
├─ g
├─ l
└─ ...
Where labels
is the former .goto
file renamed, and aliases
is a folder where all aliases will be stored.
Each alias is a executable text file with a single line: the command added by the user when registered the alias.
There is some pre-installed aliases:
g
executesgoto
l
executesgoto label
label
executesgoto label
If the user doesn't wants these default aliases, he can removes them by execute:
$ goto alias --remove-defaults
And if he wants to adds it back:
$ goto alias --add-defaults
##goto.sh
We need to prepend ~/.goto/aliases/
to the $PATH
variable inside goto.sh
(if the folder exists).