Skip to content

Instantly share code, notes, and snippets.

@DevotionGeo
Last active March 3, 2024 11:49
Show Gist options
  • Save DevotionGeo/953a7bde789369400cab840bfd7dbcf4 to your computer and use it in GitHub Desktop.
Save DevotionGeo/953a7bde789369400cab840bfd7dbcf4 to your computer and use it in GitHub Desktop.
Alias `rails` to `bin/rails` only inside a Rails directory
# Alias `rails` to `bin/rails` only inside a Rails directory
rails() {
if [ -n "$(find . -maxdepth 1 -name bin -type d -exec test -e '{}/rails' ';' -print -quit)" ] && [ -e Gemfile ]; then
bin/rails "$@"
else
command rails "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment