Awesome
terminal-aliases
Terminal aliases for faster and more convenient work with the terminal. Mainly focused on git and terraform work.
Installation
ZSH
Using Oh-my-zsh:
- Clone this repository in oh-my-zsh's plugins directory:
git clone https://github.com/dvir-levy/terminal-aliases.git ~/.oh-my-zsh/custom/plugins/terminal-aliases
- Activate the plugin in ~/.zshrc<br /> NOTE: add the plugin last in order so it could overwrite other aliases if any.
plugins=(
plugin1
plugin2
...
teminal-aliases
)
- Set the WORKSPACE_PATH environment variable to your own workspace directory that include your repos.<br /> NOTE: The environment variable must be set before the plugins call in ~/.zshrc
export WORKSPACE_PATH=<MY_WORKSPACE>
The following script adds it to the beginning of ~/.zshrc. Make sure to change <MY_WORKSPACE> to your workspaces path.
echo "export WORKSPACE_PATH=<MY_WORKSPACE>" > ~/.zshrc.tmp
echo "" >> ~/.zshrc.tmp
cat ~/.zshrc >> ~/.zshrc.tmp
mv ~/.zshrc.tmp ~/.zshrc
echo "# terminal-aliases plugin" > ~/.zshrc.tmp
echo "" >> ~/.zshrc.tmp
cat ~/.zshrc >> ~/.zshrc.tmp
mv ~/.zshrc.tmp ~/.zshrc
NOTE: the folders structure should be single workspace with several repos in it. for example:
.my-workspace
├──repo1
├──repo2
├──repo3
├──terraform-repo1
└──terraform-repo2
- Run exec zsh to take changes into account:
exec zsh
Using zplug:
- Add this repo to
~/.zshrc
:
zplug "dvir-levy/terminal-aliases", as: plugin
Usage Examples
<img width="400" height="250" alt="color picker" src="https://github.com/dvir-levy/terminal-aliases/assets/79982395/a04d81c9-0742-4997-982e-1bb883846d86" />- git checkout to main/master and pull
gcm
- git status
gst
- Create new GitHub Pull Request
newpr my_new_pr_name SECURITY-357
NOTE: the branch should be main/master and commit changes should be made locally on master. the alias will makes sure to create new branch and pull request.
- 'git add' to all changes, 'git commit' with your custom comment and 'git push' - all together
gam "added debugging methods"
- change directory to a repo and show its content
repo1
- terraform apply
ta
- terraform init + terraform plan
tip
License
This repo is licensed under the terms of the MIT Open Source license and is available for free. Feel free to open pull request and help improve it