From f07a338da236fcd3ebdb8877a18c29f2a33267d7 Mon Sep 17 00:00:00 2001 From: adam j hartz Date: Thu, 19 Mar 2015 07:51:14 -0400 Subject: [PATCH] rename some environment variables --- xonsh/environ.py | 2 ++ xonsh/shell.py | 6 +++--- xonsh/tools.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xonsh/environ.py b/xonsh/environ.py index 7a2275cee..35bcba6dc 100644 --- a/xonsh/environ.py +++ b/xonsh/environ.py @@ -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, diff --git a/xonsh/shell.py b/xonsh/shell.py index bf519f58e..bcb873331 100644 --- a/xonsh/shell.py +++ b/xonsh/shell.py @@ -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)) diff --git a/xonsh/tools.py b/xonsh/tools.py index e5b0b6819..2ecdad7ff 100644 --- a/xonsh/tools.py +++ b/xonsh/tools.py @@ -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')