forked from platformio/platformio-core
Enhance commands output
This commit is contained in:
@ -18,6 +18,7 @@ def cli(query, json_output): # pylint: disable=R0912
|
||||
|
||||
BOARDLIST_TPL = ("{type:<30} {mcu:<14} {frequency:<8} "
|
||||
" {flash:<7} {ram:<6} {name}")
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
|
||||
grpboards = {}
|
||||
for type_, data in get_boards().items():
|
||||
@ -31,12 +32,14 @@ def cli(query, json_output): # pylint: disable=R0912
|
||||
if query.lower() not in search_data.lower():
|
||||
continue
|
||||
|
||||
click.echo("\nPlatform: %s" % platform)
|
||||
click.echo("-" * 75)
|
||||
click.echo("")
|
||||
click.echo("Platform: ", nl=False)
|
||||
click.secho(platform, bold=True)
|
||||
click.echo("-" * terminal_width)
|
||||
click.echo(BOARDLIST_TPL.format(
|
||||
type=click.style("Type", fg="cyan"), mcu="MCU",
|
||||
frequency="Frequency", flash="Flash", ram="RAM", name="Name"))
|
||||
click.echo("-" * 75)
|
||||
click.echo("-" * terminal_width)
|
||||
|
||||
for type_, data in sorted(boards.items(), key=lambda b: b[1]['name']):
|
||||
if query:
|
||||
|
@ -21,7 +21,9 @@ def echo_liblist_header():
|
||||
authornames="Authors",
|
||||
description="Description"
|
||||
))
|
||||
click.echo("-" * 85)
|
||||
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
click.echo("-" * terminal_width)
|
||||
|
||||
|
||||
def echo_liblist_item(item):
|
||||
|
@ -86,11 +86,12 @@ def platforms_search(query, json_output):
|
||||
if json_output:
|
||||
click.echo(json.dumps(data))
|
||||
else:
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
for item in data:
|
||||
click.secho(item['type'], fg="cyan", nl=False)
|
||||
click.echo(" (available packages: %s)" % ", ".join(
|
||||
p.get_packages().keys()))
|
||||
click.secho("-" * len(item['type']), fg="cyan")
|
||||
click.echo("-" * terminal_width)
|
||||
click.echo(item['description'])
|
||||
click.echo()
|
||||
|
||||
|
@ -25,7 +25,7 @@ def serialports_list(json_output):
|
||||
|
||||
for item in get_serialports():
|
||||
click.secho(item['port'], fg="cyan")
|
||||
click.echo("----------")
|
||||
click.echo("-" * len(item['port']))
|
||||
click.echo("Hardware ID: %s" % item['hwid'])
|
||||
click.echo("Description: %s" % item['description'])
|
||||
click.echo("")
|
||||
|
@ -16,6 +16,7 @@ def cli():
|
||||
def settings_get(name):
|
||||
|
||||
list_tpl = "{name:<40} {value:<35} {description}"
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
|
||||
click.echo(list_tpl.format(
|
||||
name=click.style("Name", fg="cyan"),
|
||||
@ -23,7 +24,7 @@ def settings_get(name):
|
||||
click.style(" [Default]", fg="yellow")),
|
||||
description="Description"
|
||||
))
|
||||
click.echo("-" * 90)
|
||||
click.echo("-" * terminal_width)
|
||||
|
||||
for _name, _data in sorted(app.DEFAULT_SETTINGS.items()):
|
||||
if name and name != _name:
|
||||
|
@ -193,6 +193,10 @@ def check_internal_updates(ctx, what):
|
||||
if not outdated_items:
|
||||
return
|
||||
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
|
||||
click.echo("")
|
||||
click.echo("*" * terminal_width)
|
||||
click.secho("There are the new updates for %s (%s)" %
|
||||
(what, ", ".join(outdated_items)), fg="yellow")
|
||||
|
||||
@ -201,7 +205,7 @@ def check_internal_updates(ctx, what):
|
||||
click.secho("`platformio %s update`" %
|
||||
("lib" if what == "libraries" else "platforms"),
|
||||
fg="cyan", nl=False)
|
||||
click.secho(" command.\n", fg="yellow")
|
||||
click.secho(" command.", fg="yellow")
|
||||
else:
|
||||
click.secho("Please wait while updating %s ..." % what, fg="yellow")
|
||||
if what == "platforms":
|
||||
@ -212,3 +216,6 @@ def check_internal_updates(ctx, what):
|
||||
|
||||
telemetry.on_event(category="Auto", action="Update",
|
||||
label=what.title())
|
||||
|
||||
click.echo("*" * terminal_width)
|
||||
click.echo("")
|
||||
|
Reference in New Issue
Block a user