سؤال

When I'm in a Rails project, how do I save myself from typing

foreman run rails console

every time? In other words, is there a way to automatically prefix rails and rake commands with foreman run automatically?

هل كانت مفيدة؟

المحلول

Use a bash function:

rails () {
    if test current directory is in a rails project  # left as an exercise
    then
        foreman run rails "$@"
    else
        command rails "$@"
    fi
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top