-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update listr2 and add a processTasks option to CLI * remove checksToListr and push up processTasks * add a place on the CLI to collect listr tasks * rework listr task running * rework listr task running part 2 * Bump to dockerfile-build branch of @lando/core for testing purposes
- Loading branch information
Showing
10 changed files
with
240 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
const {Listr} = require('listr2'); | ||
|
||
// we do this to coax out the default renderer class so we can extend it | ||
const listr = new Listr([], {renderer: 'verbose', fallbackRenderer: 'verbose'}); | ||
|
||
class LandoDebugRenderer extends listr.rendererClass { | ||
static debug = require('debug')('lando:debug-renderer'); | ||
|
||
constructor(tasks, options, $renderHook) { | ||
super(tasks, options, $renderHook); | ||
this.options.level = 0; | ||
const debug = options.log || LandoDebugRenderer.debug; | ||
|
||
// update the logger with our debug wrapper | ||
this.logger.log = (level, message, options) => { | ||
const output = debug(this.logger.format(level, message, options)); | ||
|
||
if (output && this.logger.options.toStderr.includes(level)) { | ||
this.logger.process.toStderr(output); | ||
return; | ||
} | ||
|
||
if (output) this.logger.process.toStdout(output); | ||
}; | ||
} | ||
} | ||
|
||
module.exports = LandoDebugRenderer; | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
|
||
const {EOL} = require('os'); | ||
const {Listr} = require('listr2'); | ||
|
||
// we do this to coax out the default renderer class so we can extend it | ||
const listr = new Listr([], {renderer: 'default', fallbackRenderer: 'default'}); | ||
|
||
class LandoRenderer extends listr.rendererClass { | ||
constructor(tasks, options, $renderHook) { | ||
super(tasks, options, $renderHook); | ||
this.options.level = options.level || 0; | ||
} | ||
|
||
create(options) { | ||
options = { | ||
tasks: true, | ||
bottomBar: true, | ||
prompt: true, | ||
...options, | ||
}; | ||
|
||
const render = []; | ||
|
||
const renderTasks = this.renderer(this.tasks, this.options.level); | ||
const renderBottomBar = this.renderBottomBar(); | ||
const renderPrompt = this.renderPrompt(); | ||
|
||
if (options.tasks && renderTasks.length > 0) render.push(...renderTasks); | ||
|
||
if (options.bottomBar && renderBottomBar.length > 0) { | ||
if (render.length > 0) render.push(''); | ||
render.push(...renderBottomBar); | ||
} | ||
|
||
if (options.prompt && renderPrompt.length > 0) { | ||
if (render.length > 0) render.push(''); | ||
render.push(...renderPrompt); | ||
} | ||
|
||
return render.join(EOL); | ||
} | ||
} | ||
|
||
module.exports = LandoRenderer; | ||
|
Oops, something went wrong.