mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
dirstack skeleton
This commit is contained in:
parent
a587a1719d
commit
0889913cfd
2 changed files with 19 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue