code: def main(argv=None):
      
      parser = build_argparser()
  
      args = parser.parse_args(argv)
  
      logging.basicConfig(level=args.loglevel, format="%(message)s")
  
      check_args(parser, args)
  
      if args.extract:
          marfile = os.path.abspath(args.extract)
          if args.chdir:
              os.chdir(args.chdir)
          do_extract(marfile, os.getcwd(), args.compression)
  
      elif args.verify:
          do_verify(args.verify, args.keyfiles)
  
      elif args.list:
          print("\n".join(do_list(args.list)))
  
      elif args.list_detailed:
          print("\n".join(do_list(args.list_detailed, detailed=True)))
  
      elif args.create:
          marfile = os.path.abspath(args.create)
          signing_key, signing_algorithm = get_key_from_cmdline(parser, args)
  
          if args.chdir:
              os.chdir(args.chdir)
          do_create(marfile, args.files, args.compression,
                    productversion=args.productversion, channel=args.channel,
                    signing_key=signing_key, signing_algorithm=signing_algorithm)
  
      elif args.hash:
          do_hash(args.hash, args.files[0], args.asn1)
  
      elif args.add_signature:
          do_add_signature(args.add_signature[0], args.add_signature[1], args.add_signature[2])
  
      # sanity check; should never happen
      else:  # pragma: no cover
          parser.error("Unsupported action")
docs: Run the main CLI entry point.