diff --git a/CHANGELOG b/CHANGELOG index bf4a263..a525f2e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +v0.5.3 +====== +Now you can configure a ~/.bpythonrc file (or pass a rc file at the +command line (bpython /foo/bar). See README for details. + v0.5.2 ====== help() actually displays the full help page, and I fixed up the diff --git a/README b/README index 30df031..6326f30 100644 --- a/README +++ b/README @@ -95,16 +95,16 @@ as you type. the screen data will be flushed to stdout, so it basically looks the same as if you had quit the vanilla interpreter. +Configuration +============= +See the sample-rc file for a list of available options. +You should save your rc file as ~/.bpythonrc or specify +at the command line: + +bpython /path/to/bpythonrc + Known Bugs ========== -* There's some weirdness when you use rewind sometimes with how -it displays the text afterwards, I haven't had enough time to -sit down and look at exactly what's causing it, as it doesn't -seem to happen a lot, and it fixes itself pretty quickly anyway. - * Triple quoted strings over multiple lines work, but they're not highlighted properly. - -* There is no way to configure the keys or the pastebin options, -this is a definite for the next release. diff --git a/bpython.py b/bpython.py index 81d2554..b5d9859 100644 --- a/bpython.py +++ b/bpython.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# bpython 0.5.2::fancy curses interface to the Python repl::Bob Farrell 2008 +# bpython 0.5.3::fancy curses interface to the Python repl::Bob Farrell 2008 # # The MIT License # @@ -64,9 +64,9 @@ try: Group, OneOrMore, ZeroOrMore, Literal, Optional, Word, \ alphas, alphanums, printables, ParseException except ImportError: - OPTS.argspec = False + OPTS.arg_spec = False else: - OPTS.argspec = True + OPTS.arg_spec = True import pydoc @@ -219,7 +219,7 @@ class Repl( object ): self.list_win_visible = False - if not OPTS.argspec: + if not OPTS.arg_spec: return pexp = Forward() @@ -328,7 +328,7 @@ class Repl( object ): r = t return r - if not OPTS.argspec: + if not OPTS.arg_spec: return False t = parse_parens( self.s ) @@ -1400,8 +1400,10 @@ def loadrc(): bools = { 'true': True, 'yes': True, + 'on': True, 'false': False, - 'no': False + 'no': False, + 'off': False } config = {} @@ -1412,9 +1414,12 @@ def loadrc(): if not k: break + k = k.lower() + if parser.get_token() == '=': v = parser.get_token() or None + print v if v is not None: try: v = int(v) @@ -1423,9 +1428,9 @@ def loadrc(): v = bools[v.lower()] config[k] = v - + f.close() - for k in config: + for k, v in config.iteritems(): if hasattr( OPTS, k ): setattr( OPTS, k, v ) diff --git a/sample-rc b/sample-rc new file mode 100644 index 0000000..3769b1e --- /dev/null +++ b/sample-rc @@ -0,0 +1,15 @@ +# positives: yes, true, on +# negatives: no, false, off +# This is parsed using shlex, so any future versions that use +# string options and stuff should be escaped properly. + +# Display the autocomplete list as you type (default: on). +# When this is off, you can hit tab to see the suggestions. +auto_display_list = yes + +# Syntax highlighting as you type (default: on). +syntax = on + +# Display the arg spec (list of arguments) for callables, +# when possible (default: on). +arg_spec = true