diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-02-24 19:37:17 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-02-24 20:07:51 +0200 |
commit | 199190d6cdd18a6374d4338ebb31bd8f2659e55a (patch) | |
tree | 5de3df1d51ce6397af200b6a8f1e5099e3063bd1 /ick | |
parent | a5bd847ccfe517b8e1c0e5e5f93ac5a570203858 (diff) | |
download | ick-199190d6cdd18a6374d4338ebb31bd8f2659e55a.tar.gz |
Add --verbose option
Diffstat (limited to 'ick')
-rwxr-xr-x | ick | 34 |
1 files changed, 12 insertions, 22 deletions
@@ -18,7 +18,6 @@ import cliapp -import ttystatus import yaml import icklib @@ -36,13 +35,18 @@ class Ick(cliapp.Application): 'only build PROJECT (can be used multiple times)') self.settings.boolean( - ['quiet', 'silent'], + ['quiet', 'silent', 'q'], 'reduce how much output from commands is shown') + self.settings.boolean( + ['verbose', 'v'], + 'be more verbose and use wall-of-text progress reporting, ' + 'instead of a fancy terminal one') + def process_args(self, args): filename = self.parse_command_line_args(args) ick = self.read_ick_file(filename) - self.progress = self.create_ttystatus() + self.progress = self.create_progress() self.build_projects(ick) self.progress.finish() @@ -55,27 +59,13 @@ class Ick(cliapp.Application): with open(filename) as f: return yaml.safe_load(f) - def create_ttystatus(self): - ts = ttystatus.TerminalStatus(period=1) - + def create_progress(self): if self.settings['quiet']: - ts.max_output_lines = 0 + return icklib.QuietProgress() + elif self.settings['verbose']: + return icklib.VerboseProgress() else: - _, height = ts.get_terminal_size() - format_lines = [ - '%ElapsedTime() ' - 'Project %Index(project,projects) %String(project_name)', - 'Pipeline: %String(pipeline)', - 'Step: %String(step)', - 'Target: %String(target)', - 'Command: %String(command)', - 'Output: %String(line0)', - ] - ts.max_output_lines = height - len(format_lines) - for i in range(1, ts.max_output_lines): - format_lines.append(' : %%String(line%d)' % i) - ts.format('\n'.join(format_lines)) - return ts + return icklib.FancyProgress() def build_projects(self, ick): statedir = icklib.create_statedir_from_ick(ick) |