From 581c7970ad5f3d6518c2f9e149f5e3bd8324eae9 Mon Sep 17 00:00:00 2001 From: Marcel Bollmann Date: Mon, 23 Mar 2015 13:57:29 +0100 Subject: [PATCH] Command line switch --no-rc --- xonsh/main.py | 7 ++++++- xonsh/shell.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/xonsh/main.py b/xonsh/main.py index 360e91020..a0686463f 100644 --- a/xonsh/main.py +++ b/xonsh/main.py @@ -14,6 +14,11 @@ parser.add_argument('-c', dest='command', required=False, default=None) +parser.add_argument('--no-rc', + help="Do not load the .xonshrc file", + dest='norc', + action='store_true', + default=False) parser.add_argument('file', metavar='script-file', help='If present, execute the script in script-file' @@ -33,7 +38,7 @@ def main(argv=None): args = parser.parse_args() - shell = Shell() + shell = Shell() if not args.norc else Shell(ctx={}) env = builtins.__xonsh_env__ diff --git a/xonsh/shell.py b/xonsh/shell.py index dcf70e427..0cf67b466 100644 --- a/xonsh/shell.py +++ b/xonsh/shell.py @@ -90,8 +90,8 @@ class Shell(Cmd): stdout=stdout) self.execer = Execer() env = builtins.__xonsh_env__ - self.ctx = ctx or xonshrc_context(rcfile=env.get('XONSHRC', None), - execer=self.execer) + self.ctx = ctx if ctx is not None else \ + xonshrc_context(rcfile=env.get('XONSHRC', None), execer=self.execer) self.completer = Completer() self.buffer = [] self.need_more_lines = False