From dc86b98591eda77504d31da13a7f72852d44e2df Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Thu, 21 Dec 2017 16:26:24 +0100
Subject: [PATCH] Add comments to explain best practices

---
 bob/extension/scripts/config.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bob/extension/scripts/config.py b/bob/extension/scripts/config.py
index ca779b1..4b6fde0 100644
--- a/bob/extension/scripts/config.py
+++ b/bob/extension/scripts/config.py
@@ -5,6 +5,7 @@ from ..rc_config import _saverc, _rc_to_str, _get_rc_path
 import logging
 import click
 
+# Use the normal logging module. Verbosity and format of logging is already set
 logger = logging.getLogger(__name__)
 
 
@@ -26,6 +27,8 @@ def show():
 
     Displays the content of bob's global configuration file.
     """
+    # always use click.echo instead of print
+    # always pass the log_file to the echo function
     log_file = click.get_current_context().meta['log_file']
     click.echo("Displaying `{}':".format(_get_rc_path()), log_file)
     click.echo(_rc_to_str(rc), log_file)
@@ -52,6 +55,7 @@ def get(key):
     log_file = click.get_current_context().meta['log_file']
     value = rc[key]
     if value is None:
+        # Exit the command line with ClickException in case of errors.
         raise click.ClickException(
             "The requested key `{}' does not exist".format(key))
     click.echo(value, log_file)
-- 
GitLab