Merge branch 'cassandra-1.0' into cassandra-1.1.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e3c4c095 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e3c4c095 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e3c4c095 Branch: refs/heads/cassandra-1.1.0 Commit: e3c4c095f04c9760afed9d71d3d0572dd15c9c65 Parents: 81e609d 270d016 Author: Brandon Williams <[email protected]> Authored: Tue Mar 27 14:30:51 2012 -0500 Committer: Brandon Williams <[email protected]> Committed: Tue Mar 27 14:30:51 2012 -0500 ---------------------------------------------------------------------- bin/cqlsh | 111 +++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 77 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e3c4c095/bin/cqlsh ---------------------------------------------------------------------- diff --cc bin/cqlsh index 5ea3bd5,7431bee..2c3d410 --- a/bin/cqlsh +++ b/bin/cqlsh @@@ -453,20 -416,14 +482,20 @@@ class Shell(cmd.Cmd) self.in_comment = False self.schema_overrides = {} - if sys.stdin.isatty(): - self.prompt = Shell.default_prompt + self.prompt = '' + if stdin is None: + stdin = sys.stdin + self.tty = tty + if tty: + self.prompt = self.default_prompt self.report_connection() - self.printout('Use HELP for help.') + print 'Use HELP for help.' else: - self.prompt = "" + self.show_line_nums = True + self.stdin = stdin + self.query_out = sys.stdout - def myformat_value(self, val, casstype): + def myformat_value(self, val, casstype, **kwargs): if isinstance(val, DecodeError): self.decoding_errors.append(val) return format_value(val, casstype, self.output_codec.name, @@@ -889,10 -802,11 +931,11 @@@ def print_dynamic_result(self, cursor): for row in cursor: colnames, coltypes = zip(*cursor.description)[:2] - colnames = [self.myformat_colname(name) for name in colnames] + colnames_t = [(name, self.get_nametype(cursor, n)) for (n, name) in enumerate(colnames)] + colnames = [self.myformat_colname(name, nametype) for (name, nametype) in colnames_t] colvals = [self.myformat_value(val, casstype) for (val, casstype) in zip(row, coltypes)] line = ' | '.join('%s,%s' % (n.coloredval, v.coloredval) for (n, v) in zip(colnames, colvals)) - print ' ' + line + self.writeresult(' ' + line) def emptyline(self): pass
