code: def main():
      
      # Parse command line arguments
      args = parse_args()
  
      label = args.label
      threshold_text = args.args
      suffix = args.suffix
  
      # Check whether thresholds were sent as one word, and is in the
      # list of templates.  If so, swap in the template.
      if len(args.args) == 1 and args.args[0] in BADGE_TEMPLATES:
          template_name = args.args[0]
          template_dict = BADGE_TEMPLATES[template_name]
          threshold_text = template_dict['threshold'].split(' ')
          if not args.label:
              label = template_dict['label']
          if not args.suffix and 'suffix' in template_dict:
              suffix = template_dict['suffix']
  
      if not label:
          raise ValueError('Label has not been set.  Please use --label argument.')
  
      # Create threshold list from args
      threshold_list = [x.split('=') for x in threshold_text]
      threshold_dict = {x[0]: x[1] for x in threshold_list}
  
      # Create badge object
      badge = Badge(label, args.value, value_prefix=args.prefix, value_suffix=suffix,
                    default_color=args.color, num_padding_chars=args.padding, font_name=args.font,
                    font_size=args.font_size, template=args.template,
                    use_max_when_value_exceeds=args.use_max, thresholds=threshold_dict,
                    value_format=args.value_format, text_color=args.text_color)
  
      if args.file:
          # Write badge SVG to file
          badge.write_badge(args.file, overwrite=args.overwrite)
      else:
          print(badge.badge_svg_text)
docs: Generate a badge based on command line arguments.