rename some environment variables

This commit is contained in:
adam j hartz 2015-03-19 07:51:14 -04:00
parent 637702f861
commit f07a338da2
3 changed files with 6 additions and 4 deletions

View file

@ -49,6 +49,7 @@ def current_branch(cwd=None):
default_prompt = ('{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} '
'{cwd}{BOLD_RED}{curr_branch} {BOLD_BLUE}${NO_COLOR} ')
default_title = '{user}@{hostname}: {cwd} | xonsh'
def format_prompt(template=default_prompt):
"""Formats a xonsh prompt template string.
@ -106,6 +107,7 @@ def multiline_prompt():
BASE_ENV = {
'INDENT': ' ',
'PROMPT': default_prompt,
'TITLE': default_title,
'MULTILINE_PROMPT': '.',
'XONSHRC': os.path.expanduser('~/.xonshrc'),
'XONSH_HISTORY_SIZE': 8128,

View file

@ -172,12 +172,12 @@ class Shell(Cmd):
term = env.get('TERM', None)
if term is None or term == 'linux':
return
if 'XONSH_TITLE' in env:
t = env['XONSH_TITLE']
if 'TITLE' in env:
t = env['TITLE']
if callable(t):
t = t()
else:
t = '{user}@{hostname}: {cwd} | xonsh'
return
t = format_prompt(t)
sys.stdout.write("\x1b]2;{0}\x07".format(t))

View file

@ -224,7 +224,7 @@ class redirect_stderr(_RedirectStream):
def suggest_commands(cmd, env, aliases):
"""Suggests alternative commands given an environment and aliases."""
if(env.get('SUGGEST_COMMANDS', True)):
threshold = env.get('SUGGEST_ERROR_THRESHOLD', 3)
threshold = env.get('SUGGEST_THRESHOLD', 3)
max_sugg = env.get('SUGGEST_MAX_NUM', 5)
if max_sugg < 0:
max_sugg = float('inf')