text: # MIT License
  #
  # Copyright (c) 2017 Tom Melo
  #
  # Permission is hereby granted, free of charge, to any person obtaining a copy
  # of this software and associated documentation files (the "Software"), to deal
  # in the Software without restriction, including without limitation the rights
  # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  # copies of the Software, and to permit persons to whom the Software is
  # furnished to do so, subject to the following conditions:
  #
  # The above copyright notice and this permission notice shall be included in all
  # copies or substantial portions of the Software.
  #
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  # SOFTWARE
  
  #!/usr/bin/env python
  # -*- coding: utf-8; mode: python; py-indent-offset: 4;indent-tabs-mode: nil -*-
  # vim: fileencoding=utf-8 tabstop=4 expandtab shiftwidth=4
  # pylint: disable=C0103,C0301,W1202,W0212
  
  """
  The helpformatter module.
  
  This module contains the HelpFormatter class.
  The HelpFormatter class is a helper class that pretty prints the help
  usage of argparse.
  """
  
  import argparse
  
  class HelpFormatter(argparse.HelpFormatter):
      """A custom help formatter for argparse"""
  
      def _format_action_invocation(self, action):
          if not action.option_strings:
              metavar, = self._metavar_formatter(action, action.dest)(1)
              return metavar
          else:
              parts = []
              if action.nargs == 0:
                  parts.extend(action.option_strings)
  
              else:
                  default = action.dest.upper()
                  args_string = self._format_args(action, default)
                  for option_string in action.option_strings:
                      parts.append('%s' % option_string)
                  parts[-1] += ' %s'%args_string
              return ', '.join(parts)