Permalink
Browse files

irunner: prefer command line option over extension for mode

closes gh-594
  • Loading branch information...
1 parent bbe178a commit 9ad15631f22f1bc8093429e5383919ade19a0e3f @juliantaylor committed Jul 19, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 IPython/lib/irunner.py
@@ -410,7 +410,6 @@ def main():
parser = optparse.OptionParser(usage=MAIN_USAGE)
newopt = parser.add_option
- parser.set_defaults(mode='ipython')
newopt('--ipython',action='store_const',dest='mode',const='ipython',
help='IPython interactive runner (default).')
newopt('--python',action='store_const',dest='mode',const='python',
@@ -430,7 +429,9 @@ def main():
modes = {'.ipy':'ipython',
'.py':'python',
'.sage':'sage'}
- mode = modes.get(ext,opts.mode)
+ mode = modes.get(ext,"ipython")
+ if opts.mode:
+ mode = opts.mode
runners[mode]().main(args)
if __name__ == '__main__':

0 comments on commit 9ad1563

Please sign in to comment.