Added help to the CLI and fixed a bug that was causing it to crash
after my last submit. There is still cleanup left to do  in the way
tables are displayed as a result of the changes. This will be tackled
in a subsequent update.

Change-Id: Id09c39e24a5dbfb3ebce45783b4e7ec2096e905e
diff --git a/cli/device.py b/cli/device.py
index 5dba144..adef6ff 100644
--- a/cli/device.py
+++ b/cli/device.py
@@ -57,6 +57,22 @@
 
     do_exit = Cmd.do_quit
 
+    def do_quit(self, line):
+        if self.pm_config_dirty:
+            self.poutput("Uncommited changes for " + \
+                         self.colorize(
+                             self.colorize("perf_config,", "blue"),
+                             "bold") + " please either " + self.colorize(
+                             self.colorize("commit", "blue"), "bold") + \
+                         " or " + self.colorize(
+                             self.colorize("reset", "blue"), "bold") + \
+                         " your changes using " + \
+                         self.colorize(
+                             self.colorize("perf_config", "blue"), "bold"))
+            return False
+        else:
+            return self._STOP_AND_EXIT
+
     def do_show(self, line):
         """Show detailed device information"""
         print_pb_as_table('Device {}'.format(self.device_id),
@@ -70,6 +86,22 @@
         print_pb_list_as_table('Device ports:', device.ports,
                                omit_fields, self.poutput)
 
+    def help_perf_config(self):
+        self.poutput(
+'''
+perfo_config [show | set | commit | reset] [-f <default frequency>] [-e <metric/group
+            name>] [-d <metric/group name>] [-o <metric/group name> <override
+            frequency>]
+Changes made by set are held locally until a commit or reset command is issued.
+A commit command will write the configuration to the device and it takes effect
+immediately. The reset command will undo any changes sinc the start of the
+device session.
+
+If grouped is tre then the -d, -e and -o commands refer to groups and not
+individual metrics.
+'''
+        )
+
     @options([
         make_option('-f', '--default_freq', action="store", dest='default_freq',
                     type='long', default=None),
@@ -77,6 +109,8 @@
                     default=None),
         make_option('-d', '--disable', action='append', dest='disable',
                     default=None),
+        make_option('-o', '--overried', action='store', dest='override',
+                    nargs=2, default=None, type='string'),
     ])
     def do_perf_config(self, line, opts):
         print(line)
@@ -131,7 +165,8 @@
                             m.enabled = False
                             self.pm_config_dirty = True
         #TODO: Add frequency overrides.
-
+        if opts.override:
+            pass
         elif line.strip() == "commit" and self.pm_config_dirty:
             stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
             stub.UpdateDevicePmConfigs(self.pm_config_last)
diff --git a/cli/main.py b/cli/main.py
index f125634..ec84bf5 100755
--- a/cli/main.py
+++ b/cli/main.py
@@ -153,7 +153,7 @@
         """List loaded adapter"""
         stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
         res = stub.ListAdapters(Empty())
-        omit_fields = {}
+        omit_fields = {'config.log_level', 'logical_device_ids'}
         print_pb_list_as_table('Adapters:', res.items, omit_fields, self.poutput)
 
     def get_devices(self):
diff --git a/cli/table.py b/cli/table.py
index 1a1f576..fd25c69 100644
--- a/cli/table.py
+++ b/cli/table.py
@@ -85,8 +85,8 @@
         if field_key not in self.field_names:
             self.field_names[field_key] = field_name
             self._update_max_length(field_key, field_name)
-        else:
-            assert self.field_names[field_key] == field_name
+        #else:
+        #    assert self.field_names[field_key] == field_name
 
 
 def print_pb_list_as_table(header, items, fields_to_omit=None,