(cqlsh) Show static columns in a different color

patch by Pavel Trukhanov; reviewed by yukim for CASSANDRA-11059
This commit is contained in:
Pavel Trukhanov 2016-03-03 14:58:35 +03:00 committed by Yuki Morishita
parent 615d0e1555
commit ab793c7f3b
2 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,5 @@
3.6
* (cqlsh) Show static columns in a different color (CASSANDRA-11059)
* Allow to remove TTLs on table with default_time_to_live (CASSANDRA-11207)

View File

@ -169,7 +169,7 @@ if os.path.isdir(cqlshlibdir):
from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling
from cqlshlib.copyutil import ExportTask, ImportTask
from cqlshlib.displaying import (ANSI_RESET, BLUE, COLUMN_NAME_COLORS, CYAN,
RED, FormattedValue, colorme)
RED, WHITE, FormattedValue, colorme)
from cqlshlib.formatting import (DEFAULT_DATE_FORMAT, DEFAULT_NANOTIME_FORMAT,
DEFAULT_TIMESTAMP_FORMAT, DateTimeFormat,
format_by_type, format_value_utype,
@ -841,6 +841,8 @@ class Shell(cmd.Cmd):
column_colors.default_factory = lambda: RED
elif name in [col.name for col in table_meta.clustering_key]:
column_colors.default_factory = lambda: CYAN
elif name in table_meta.columns and table_meta.columns[name].is_static:
column_colors.default_factory = lambda: WHITE
return self.myformat_value(name, colormap=column_colors)
def report_connection(self):