Fix unicode issue when search libraries

This commit is contained in:
Ivan Kravets
2016-08-25 14:21:46 +03:00
parent a352318f0f
commit b1cebe9e0e

View File

@ -127,6 +127,10 @@ def echo_liblist_header():
def echo_liblist_item(item): def echo_liblist_item(item):
description = item.get("description", item.get("url", "")).encode("utf-8")
if "version" in item:
description += " | @" + click.style(item['version'], fg="yellow")
click.echo( click.echo(
LIBLIST_TPL.format( LIBLIST_TPL.format(
id=click.style( id=click.style(
@ -137,10 +141,9 @@ def echo_liblist_item(item):
", ".join( ", ".join(
item.get("frameworks", ["-"]) + item.get("platforms", [])), item.get("frameworks", ["-"]) + item.get("platforms", [])),
fg="yellow"), fg="yellow"),
authornames=", ".join(item.get("authornames", ["Unknown"])), authornames=", ".join(item.get("authornames", ["Unknown"])).encode(
description=item.get("description", item.get("url", ""))) + "utf-8"),
(" | @" + click.style( description=description))
item['version'], fg="yellow") if "version" in item else ""))
@cli.command("search", short_help="Search for library") @cli.command("search", short_help="Search for library")