From b79a6ea804630a67f192bf99004642c307e598e7 Mon Sep 17 00:00:00 2001 From: Christopher Monsanto Date: Sun, 23 Aug 2020 21:23:53 -0400 Subject: [PATCH] deploy: print verbosity level --- tools/deploy/index.ts | 20 +++++++++++++------- tools/deploy/script.ts | 4 +++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/deploy/index.ts b/tools/deploy/index.ts index 72d3ab49..869faa61 100644 --- a/tools/deploy/index.ts +++ b/tools/deploy/index.ts @@ -13,10 +13,11 @@ program // TODO: default toID .option('-e, --eval ', 'Expr') .option('-m, --module ', 'Module') + .option('-v, --verbose', 'Verbose') // TODO // .option('-t, --tag ', 'Tag', collect, []) // from rename(1) - .action(async (files : string[], {eval: expr, module: mod, output: outputDir}) => { + .action(async (files : string[], {eval: expr, module: mod, output: outputDir, verbose}) => { let scr; if (expr !== undefined) { scr = new script.Script(expr, 'expr'); @@ -37,22 +38,25 @@ program aq.throw(e); } } + + const level = verbose ? 'all' : 'errors'; if (outputDir) { if (!aq.valid) { - aq.print(); + aq.print(level); process.exit(1); } aq.run(outputDir, 'copy'); } else { - aq.print(); + aq.print(level); } }); program .command('run [scripts...]') .option('-o, --output ', 'Output directory') - .action((scripts : string[], {output: outputDir}) => { + .option('-v, --verbose', 'Verbose') + .action((scripts : string[], {output: outputDir, verbose}) => { const aq = new script.ActionQueue; for (const file of scripts) { @@ -64,15 +68,17 @@ program aq.throw(e); } } - + + const level = verbose ? 'all' : 'errors'; + if (outputDir) { if (!aq.valid) { - aq.print(); + aq.print(level); process.exit(1); } aq.run(outputDir, 'link'); } else { - aq.print(); + aq.print(level); } }); diff --git a/tools/deploy/script.ts b/tools/deploy/script.ts index 40cf0424..ee6c93f0 100644 --- a/tools/deploy/script.ts +++ b/tools/deploy/script.ts @@ -74,9 +74,11 @@ export class ActionQueue { } } - print() { + print(level : 'errors' | 'all') { for (const entry of this.log) { if (entry.type === 'Copy') { + if (entry.valid === 'Success' && level === 'errors') + continue; let addendum = ''; if (entry.valid !== 'Success') { addendum = ` (${entry.valid})`;