old_contents: # (C) Datadog, Inc. 2018-present
  # All rights reserved
  # Licensed under a 3-clause BSD style license (see LICENSE)
  import click
  
  from ...e2e import get_configured_checks, get_configured_envs
  from ...testing import get_available_tox_envs
  from ...utils import get_testable_checks
  from ..console import CONTEXT_SETTINGS, echo_info, echo_success
  
  
  @click.command(context_settings=CONTEXT_SETTINGS, short_help='List active or available environments')
  @click.argument('checks', nargs=-1)
  def ls(checks):
      """List active or available environments."""
      if checks:
          checks = sorted(get_testable_checks() & set(checks))
  
          for check in checks:
              envs = get_available_tox_envs(check, e2e_only=True)
  
              if envs:
                  echo_success(f'{check}:')
                  for env in envs:
                      echo_info(env, indent=True)
  
      else:
          for check in get_configured_checks():
              envs = get_configured_envs(check)
  
              if envs:
                  echo_success(f'{check}:')
                  for env in envs:
                      echo_info(env, indent=True)
  
new_contents: # (C) Datadog, Inc. 2018-present
  # All rights reserved
  # Licensed under a 3-clause BSD style license (see LICENSE)
  import click
  
  from ...e2e import get_configured_checks, get_configured_envs
  from ...testing import get_available_tox_envs
  from ...utils import get_testable_checks
  from ..console import CONTEXT_SETTINGS, echo_info, echo_success, echo_warning
  
  
  @click.command(context_settings=CONTEXT_SETTINGS, short_help='List active or available environments')
  @click.argument('checks', nargs=-1)
  def ls(checks):
      """List active or available environments."""
      if checks:
          testable_checks = sorted(get_testable_checks() & set(checks))
  
          if not testable_checks:
              echo_warning('No testable checks found for: {}'.format(', '.join(checks)))
  
          for check in testable_checks:
              envs = get_available_tox_envs(check, e2e_only=True)
  
              if envs:
                  echo_success(f'{check}:')
                  for env in envs:
                      echo_info(env, indent=True)
              else:
                  echo_warning('No envs found for check: {}'.format(check))
  
      else:
          found = False
          for check in get_configured_checks():
              envs = get_configured_envs(check)
  
              if envs:
                  found = True
                  echo_success(f'{check}:')
                  for env in envs:
                      echo_info(env, indent=True)
  
          if not found:
              echo_warning('No envs found for configured checks')
  
subject: Add some helpful output to ddev env ls command (#5576)