config_key_notices.py 717 B

1234567891011121314151617
  1. """Notices ``hermes config set`` prints for a key path the schema does not know."""
  2. from __future__ import annotations
  3. from typing import Optional
  4. from hermes_cli.colors import Colors, color
  5. def unknown_subkey_refusal(key: str, suggestion: Optional[str]) -> str:
  6. """The refusal for a known key given under the wrong prefix (``gateway.discord.foo``)."""
  7. lines = [color(f"✗ '{key}' is not a recognized config key — nothing was written.", Colors.RED)]
  8. if suggestion:
  9. lines.append(color(f" Did you mean: {suggestion}", Colors.YELLOW))
  10. lines.append(color(
  11. " (Custom top-level keys are supported; use --force to write this path anyway.)", Colors.DIM))
  12. return "\n".join(lines)