summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-04-11 19:31:12 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-04-11 19:31:12 +0900
commita7406d86cd7d7a4e5e9273689eeabb8b51632b18 (patch)
tree1af41f08384a6985db8a893391e7ce3459184c1d
parent64c9f42632c1aae465f6962ac0b11fbb810f3607 (diff)
downloadbuildstream-a7406d86cd7d7a4e5e9273689eeabb8b51632b18.tar.gz
main.py: Custom initial loading feedback when not connected to a tty
-rw-r--r--buildstream/_frontend/main.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py
index 5555c4cd5..52d2df13d 100644
--- a/buildstream/_frontend/main.py
+++ b/buildstream/_frontend/main.py
@@ -709,21 +709,44 @@ class App():
def load_ticker(self, name):
if name:
self.file_count += 1
- click.echo("Loading: {:0>3}\r".format(self.file_count), nl=False, err=True)
+
+ if self.is_a_tty:
+ click.echo("Loading: {:0>3}\r"
+ .format(self.file_count), nl=False, err=True)
+ elif self.file_count == 1:
+ click.echo("Loading.", nl=False, err=True)
+ else:
+ click.echo(".", nl=False, err=True)
else:
click.echo('', err=True)
def resolve_ticker(self, name):
if name:
self.resolve_count += 1
- click.echo("Resolving: {:0>3}/{:0>3}\r".format(self.file_count, self.resolve_count), nl=False, err=True)
+
+ if self.is_a_tty:
+ click.echo("Resolving: {:0>3}/{:0>3}\r"
+ .format(self.file_count, self.resolve_count), nl=False, err=True)
+ elif self.resolve_count == 1:
+ click.echo("Resolving {} elements."
+ .format(self.file_count), nl=False, err=True)
+ else:
+ click.echo(".", nl=False, err=True)
else:
click.echo('', err=True)
def cache_ticker(self, name):
if name:
self.cache_count += 1
- click.echo("Checking: {:0>3}/{:0>3}\r".format(self.file_count, self.cache_count), nl=False, err=True)
+
+ if self.is_a_tty:
+ click.echo("Checking: {:0>3}/{:0>3}\r"
+ .format(self.file_count, self.cache_count), nl=False, err=True)
+ elif self.cache_count == 1:
+ click.echo("Checking {} elements."
+ .format(self.file_count, self.cache_count), nl=False, err=True)
+ else:
+ click.echo(".", nl=False, err=True)
else:
click.echo('', err=True)