Changeset - c9b6576fe5af
[Not reviewed]
feature-cli
0 1 0
Dennis Fink - 9 years ago 2015-10-24 02:10:37
dennis.fink@c3l.lu
Add some colors to stats countries output
1 file changed with 17 insertions and 3 deletions:
0 comments (0 inline, 0 general)
ennstatus/cli/commands/stats.py
Show inline comments
 
@@ -26,12 +26,26 @@ def countries(obj):
 

	
 
    for key, value in servers.items():
 
        for server in value:
 
            countries[server.country] += 1
 

	
 
    for key, value in sorted(countries.items(), key=lambda x: x[1]):
 
        click.echo('%s: %s' % (key, value))
 
        click.echo(
 
            '%s: %s' % (
 
                click.style(key, fg='green'),
 
                click.style(str(value), fg='blue')
 
            )
 
        )
 

	
 
    click.echo('Most servers are in: %s' % max(countries))
 
    click.echo(
 
        'We are hosted in %s different countries' % len(countries.keys())
 
        'Most servers are in: %s' % click.style(
 
            str(max(countries)),
 
            fg='green'
 
        )
 
    )
 

	
 
    click.echo(
 
        'We are hosted in %s different countries' % click.style(
 
            str(len(countries.keys())),
 
            fg='blue'
 
        )
 
    )
0 comments (0 inline, 0 general)