strawberry icon indicating copy to clipboard operation
strawberry copied to clipboard

Evaluate rich for use with our CLI

Open ossareh opened this issue 3 years ago • 1 comments

As discussed here: https://github.com/strawberry-graphql/strawberry/pull/1321#discussion_r726507452

tldr:

  • Emoji's do not work by default on Windows
  • https://github.com/willmcgugan/rich provides a cross platform way of interacting with terminals
  • Eval it, see if it helps with emoji on windows

ossareh avatar Oct 11 '21 21:10 ossareh

using rich will not allow for emoji usage on Windows as the shell(s) on Windows do not support emojis: https://stackoverflow.com/questions/64940181/cannot-display-emojis-in-windows-powershell-or-wsl-linux-terminal-using-python

I have tried this in the strawberry/cli/commands/server.py

from rich import print
...
def server(schema, host, port, log_level, app_dir):
    ...
    print(f"Running strawberry on http://{host}:{port}/graphql :Strawberry:\n")

this results in this output in the Windows terminal: image

mtskillman avatar May 02 '22 16:05 mtskillman