mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
more default changes
This commit is contained in:
parent
eaf96afb3c
commit
aa64655666
3 changed files with 11 additions and 15 deletions
|
@ -181,9 +181,8 @@ class BaseShell(object):
|
||||||
term = env.get('TERM', None)
|
term = env.get('TERM', None)
|
||||||
if term is None or term == 'linux':
|
if term is None or term == 'linux':
|
||||||
return
|
return
|
||||||
if 'TITLE' in env:
|
t = env.get('TITLE')
|
||||||
t = env['TITLE']
|
if t is None:
|
||||||
else:
|
|
||||||
return
|
return
|
||||||
t = format_prompt(t)
|
t = format_prompt(t)
|
||||||
if ON_WINDOWS and 'ANSICON' not in env:
|
if ON_WINDOWS and 'ANSICON' not in env:
|
||||||
|
@ -204,14 +203,11 @@ class BaseShell(object):
|
||||||
self.mlprompt = '<multiline prompt error> '
|
self.mlprompt = '<multiline prompt error> '
|
||||||
return self.mlprompt
|
return self.mlprompt
|
||||||
env = builtins.__xonsh_env__
|
env = builtins.__xonsh_env__
|
||||||
if 'PROMPT' in env:
|
p = env.get('PROMPT')
|
||||||
p = env['PROMPT']
|
try:
|
||||||
try:
|
p = format_prompt(p)
|
||||||
p = format_prompt(p)
|
except Exception:
|
||||||
except Exception:
|
print_exception()
|
||||||
print_exception()
|
|
||||||
else:
|
|
||||||
p = "set '$PROMPT = ...' $ "
|
|
||||||
self.settitle()
|
self.settitle()
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,7 @@ RE_HIDDEN = re.compile('\001.*?\002')
|
||||||
|
|
||||||
def multiline_prompt():
|
def multiline_prompt():
|
||||||
"""Returns the filler text for the prompt in multiline scenarios."""
|
"""Returns the filler text for the prompt in multiline scenarios."""
|
||||||
curr = builtins.__xonsh_env__.get('PROMPT', "set '$PROMPT = ...' $ ")
|
curr = builtins.__xonsh_env__.get('PROMPT')
|
||||||
curr = format_prompt(curr)
|
curr = format_prompt(curr)
|
||||||
line = curr.rsplit('\n', 1)[1] if '\n' in curr else curr
|
line = curr.rsplit('\n', 1)[1] if '\n' in curr else curr
|
||||||
line = RE_HIDDEN.sub('', line) # gets rid of colors
|
line = RE_HIDDEN.sub('', line) # gets rid of colors
|
||||||
|
@ -539,7 +539,7 @@ def multiline_prompt():
|
||||||
# tail is the trailing whitespace
|
# tail is the trailing whitespace
|
||||||
tail = line if headlen == 0 else line.rsplit(head[-1], 1)[1]
|
tail = line if headlen == 0 else line.rsplit(head[-1], 1)[1]
|
||||||
# now to constuct the actual string
|
# now to constuct the actual string
|
||||||
dots = builtins.__xonsh_env__.get('MULTILINE_PROMPT', '.')
|
dots = builtins.__xonsh_env__.get('MULTILINE_PROMPT')
|
||||||
dots = dots() if callable(dots) else dots
|
dots = dots() if callable(dots) else dots
|
||||||
if dots is None or len(dots) == 0:
|
if dots is None or len(dots) == 0:
|
||||||
return ''
|
return ''
|
||||||
|
|
|
@ -79,7 +79,7 @@ class HistoryGC(Thread):
|
||||||
"""Finds the history files and returns the ones that are unlocked, this is
|
"""Finds the history files and returns the ones that are unlocked, this is
|
||||||
sorted by the last closed time. Returns a list of (timestamp, file) tuples.
|
sorted by the last closed time. Returns a list of (timestamp, file) tuples.
|
||||||
"""
|
"""
|
||||||
xdd = os.path.abspath(builtins.__xonsh_env__['XONSH_DATA_DIR'])
|
xdd = os.path.abspath(builtins.__xonsh_env__.get('XONSH_DATA_DIR'))
|
||||||
fs = [f for f in iglob(os.path.join(xdd, 'xonsh-*.json'))]
|
fs = [f for f in iglob(os.path.join(xdd, 'xonsh-*.json'))]
|
||||||
files = []
|
files = []
|
||||||
for f in fs:
|
for f in fs:
|
||||||
|
@ -209,7 +209,7 @@ class History(object):
|
||||||
"""
|
"""
|
||||||
self.sessionid = sid = uuid.uuid4() if sessionid is None else sessionid
|
self.sessionid = sid = uuid.uuid4() if sessionid is None else sessionid
|
||||||
if filename is None:
|
if filename is None:
|
||||||
self.filename = os.path.join(builtins.__xonsh_env__['XONSH_DATA_DIR'],
|
self.filename = os.path.join(builtins.__xonsh_env__.get('XONSH_DATA_DIR'),
|
||||||
'xonsh-{0}.json'.format(sid))
|
'xonsh-{0}.json'.format(sid))
|
||||||
else:
|
else:
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
|
|
Loading…
Add table
Reference in a new issue