code: def run_cli(credentials):
      runner = CliRunner()
      credential_args = [
          "--user",
          credentials[0] or "",
          "--password",
          credentials[1] or "",
      ]
  
      @contextmanager
      def nullcontext():
          yield
  
      def run(*args, **kwargs):
          """Runs the sentinelsat CLI
  
          Parameters
          ----------
          *args : str
              The command-line arguments
          with_credentials : bool, optional
              Whether the credentials from DHUS_* environment variables are passed to the CLI
              as --user and --password parameters. Defaults to True.
          must_return_nonzero : bool, optiona
              Asserts that the program returns a non-zero (failure) exit code.
              A zero (success) exit code is asserted otherwise. Defaults to false.
          must_raise : Exception, optional
              If an exception type is provided asserts that a exception of this type is raised.
              Implies must_return_nonzero=True.
          **kwargs
              Any remaining keyword arguments are passed directly to CliRunner.invoke().
  
          Returns
          -------
              The click.testing.Result object returned by CliRunner.invoke().
              Includes an additional products attribute with a list of products printed
              to stdout by the program.
          """
          with_credentials = kwargs.pop("with_credentials", True)
          must_raise = kwargs.pop("must_raise", None)
          must_return_nonzero = (
              kwargs.pop("must_return_nonzero", False)
              or must_raise is not None
          )
  
          # Otherwise tqdm.write() messes up the stdout for testing
          os.environ["DISABLE_TQDM_LOGGING"] = "y"
  
          assert_raises = (
              pytest.raises(must_raise) if must_raise else nullcontext()
          )
          with assert_raises:
              result = runner.invoke(
                  cli,
                  credential_args + list(args)
                  if with_credentials
                  else args,
                  catch_exceptions=must_raise,
                  **kwargs,
              )
              if must_raise:
                  assert result.exception is not None, result.output
                  raise result.exception
          if must_return_nonzero:
              assert result.exit_code != 0, result.output
          else:
              assert result.exit_code == 0, result.output
          result.products = re.findall(
              "^Product .+$", result.output, re.M
          )
          return result
  
      return run
  
imports: import json
  import os
  import re
  import glob
  import shutil
  from contextlib import contextmanager
  from functools import partialmethod
  import pytest
  import requests_mock
  from click.testing import CliRunner
  from sentinelsat import SentinelAPI, InvalidChecksumError
  from sentinelsat.scripts.cli import cli
label_desc: Use image node_id 1 for calling a global function with example usage: run_cli(credentials) and returns: run, result