heroku / heroku-accounts

Helps use multiple accounts on Heroku.
ISC License
549 stars 38 forks source link

Assign account per folder #27

Open Loukious opened 4 years ago

Loukious commented 4 years ago

It would be nice if we could assign different accounts to different directories for dealing with different projects where each is on a different account.

zog commented 3 years ago

FYI, i added the following lines to my .zshrv:

set-heroku-account() {
  local heroku_account_setting_path=".heroku_account"

  if [ -f "${heroku_account_setting_path}" ]; then
    local heroku_account="$(cat "${heroku_account_setting_path}")"

    echo "Using heroku account ${heroku_account}"
    heroku accounts:set $heroku_account
  fi
}
add-zsh-hook chpwd set-heroku-account
set-heroku-account

Now, adding a .heroku_account file in a folder, containing the account I want to use, makes my bash switch automatically