English 中文(简体)
我如何改变我的终点站的颜色。 在Heroku的边远处,我投产吗?
原标题:How do I change the color of my Terminal.App when I log into my production remote on Heroku?

我记得,有一篇文章,或几篇文章围绕作者如何根据SSH地址从绿色(发展)到红(生产)改变终点站的颜色。

But I am not sure how to replicate that with Heroku console.

理想的情况是,我要说的是蓝色,当时我是heroku console-remoteing ,然后是红色的,当时我是heroku console -remote production

是否有任何建议?

问题回答

在作为生产环境一部分装上的任何档案中(例如,config/environments/production.rb),你可以提出:

if defined? IRB
  # whew!
  conf = IRB.conf[:PROMPT][IRB.conf[:PROMPT_MODE]]
  red = "33[0;31m"
  reset = "33[0m"
  conf[:PROMPT_S] = "#{red}>> #{reset}" # regular prompt
end

The crazy escape characters are ANSI color codes. The "33" is an escape character, and the rest is a code for a particular color or effect. You can find a list of other colors and effects here. That IRB.conf hash is a global conf for IRB. You may want to set a few other keys on it - they re documented here.

如果你不使用铁路(因此不一定有环境档案),那么你总是可以通过使用ENV[RACK_ENV]来检查目前的环境。

untested, but something along the lines of this in your .bashrc or whatever may be what you want (it s not completely safe but you should get the idea)

function heroku {
  REMOTE_TERMINAL_THEME_NAME="Solarized Light"
  CURTAB=$(osascript -e "tell application "Terminal" to get the selected tab of the front window")
  CURTHEME=$(osascript -e "tell application "Terminal" to get the name of current settings of the selected tab of the front window")
  HEROKU=$(which heroku)
  osascript -e "tell application "Terminal" to set current settings of $CURTAB to settings set "$REMOTE_TERMINAL_THEME_NAME""

  $HEROKU "$@"
  osascript -e "tell application "Terminal" to set current settings of $CURTAB to settings set  "$CURTHEME""
}

我把它用于sh,但从概念上说是一样的:凌驾于你的指挥,其职能是使用撒布特来改变终端环境,然后将其撤回。 基于论点的转换应当比较容易增加。

在我看来,当你把 alia子打成 alia子或bat子时,你可以将其自动化。 有一个条款,即简单的对应指挥可以改变你的肤色,直到你再回来。

因此,如果您的一位六位用户,你可以与你一道这样做。

#pretend this is a bunch of prompt setup
#USER ALIASES
alias heroku-staging="export     PS1="e[0;34m[Heroku Staging]$]" && heroku console --remote staging"

然后,仅打上 her湖。





相关问题
Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Bash usage of vi or emacs

From a programming standpoint, when you set the bash shell to use vi or emacs via set -o vi or set -o emacs What is actually going on here? I ve been reading a book where it claims the bash shell ...

Dynamically building a command in bash

I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log ...

Perform OR on two hash outputs of sha1sum

I want perform sha1sum file1 and sha1sum file2 and perform bitwise OR operation with them using bash. Output should be printable i.e 53a23bc2e24d039 ... (160 bit) How can I do this? I know echo $(( ...

Set screen-title from shellscript

Is it possible to set the Screen Title using a shell script? I thought about something like sending the key commands ctrl+A shift-A Name enter I searched for about an hour on how to emulate ...

热门标签