docs: def main(argv: typing.Optional[typing.Sequence] = None) -> typing.NoReturn:
      """Main entry point for the konch CLI."""
      args = parse_args(argv)
  
      if args["--debug"]:
          logging.basicConfig(
              format="%(levelname)s %(filename)s: %(message)s", level=logging.DEBUG
          )
      logger.debug(args)
  
      config_file: typing.Union[Path, None]
      if args["init"]:
          config_file = Path(args["<config_file>"] or CONFIG_FILE)
          init_config(config_file)
      else:
          config_file = Path(args["<config_file>"]) if args["<config_file>"] else None
          if args["edit"]:
              edit_config(config_file)
          elif args["allow"]:
              allow_config(config_file)
          elif args["deny"]:
              deny_config(config_file)
  
      mod = use_file(Path(args["--file"]) if args["--file"] else None)
      if hasattr(mod, "setup"):
          mod.setup()  # type: ignore
  
      if args["--name"]:
          if args["--name"] not in _config_registry:
              print_error(f'Invalid --name: "{args["--name"]}"')
              sys.exit(1)
          config_dict = _config_registry[args["--name"]]
          logger.debug(f'Using named config: "{args["--name"]}"')
          logger.debug(config_dict)
      else:
          config_dict = _cfg
      # Allow default shell to be overriden by command-line argument
      shell_name = args["--shell"]
      if shell_name:
          config_dict["shell"] = SHELL_MAP.get(shell_name.lower(), AutoShell)
      logger.debug(f"Starting with config {config_dict}")
      start(**config_dict)
  
      if hasattr(mod, "teardown"):
          mod.teardown()  # type: ignore
      sys.exit(0)