Sometimes typing long commands very often is quite annoying. There is a very simple solution for this. You can create an alias for given command which means that you can type your own command which would trigger another command.
Let’s say that every time you want to run your test suite you have to execute following code:
bundle exec rspec spec/models spec/controllers spec/helpers --format documentation
it will be a lot faster and easier to run tests by typing just this command:
Create new file, name it
rails_aliases.sh and put following command there:
alias run_tests='bundle exec rspec spec/models spec/controllers spec/helpers --format documentation'
Reload file in your console:
and you can run tests using your new and shorter command.
Of course, you may not want to create such file in main project directory because of other team members or any other reason. Instead of creating a new file you can edit your
~/.bashrc file and put all aliases there.
Photo by Tim Gouw from Pexels https://www.pexels.com/photo/man-in-white-shirt-using-macbook-pro-5260