dirstack skeleton

This commit is contained in:
adam j hartz 2015-03-16 05:52:13 -04:00
parent a587a1719d
commit 0889913cfd
2 changed files with 19 additions and 0 deletions

View file

@ -4,6 +4,7 @@ import os
import platform
import builtins
import subprocess
from argparse import ArgumentParser
def cd(args, stdin=None):
"""Changes the directory.
@ -25,6 +26,18 @@ def cd(args, stdin=None):
builtins.__xonsh_env__['PWD'] = os.getcwd()
return None, None
pushd_parser = ArgumentParser(description="pushd: push onto the directory stack")
def pushd(args, stdin=None):
return None, None
popd_parser = ArgumentParser(description="popd: pop from the directory stack")
def popd(args, stdin=None):
return None, None
dirs_parser = ArgumentParser(description="dirs: view and manipulate the directory stack")
def dirs(args, stdin=None):
return None, None
def exit(args, stdin=None):
"""Sends signal to exit shell."""
builtins.__xonsh_exit__ = True
@ -57,6 +70,9 @@ def source_bash(args, stdin=None):
DEFAULT_ALIASES = {
'cd': cd,
'pushd':pushd,
'popd':popd,
'dirs':dirs,
'EOF': exit,
'exit': exit,
'source-bash': source_bash,

View file

@ -93,6 +93,7 @@ def multiline_prompt():
BASE_ENV = {
'INDENT': ' ',
'XONSH_DIRSTACK': None,
'PROMPT': default_prompt,
'MULTILINE_PROMPT': '.',
'XONSHRC': os.path.expanduser('~/.xonshrc'),
@ -149,6 +150,8 @@ def default_env(env=None):
"""Constructs a default xonsh environment."""
# in order of increasing precedence
ctx = dict(BASE_ENV)
if ctx.get('XONSH_DIRSTACK',None) is None:
ctx['XONSH_DIRSTACK'] = []
ctx.update(os.environ)
ctx.update(bash_env())
if env is not None: