Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build or find better way of pretty-printing arbitrary data to the browser console in CliRepl #101

Open
carnesen opened this issue Jul 4, 2020 · 0 comments
Labels
website Pertains to @carnesen/cli-website
Milestone

Comments

@carnesen
Copy link
Owner

carnesen commented Jul 4, 2020

In Node.js, console.log
pretty-prints the object to the terminal

In the the browser currently we have a very hacky way of handling that:

cli/website/src/cli-repl.ts

Lines 173 to 188 in 9d807d4

private consoleLog(arg: any) {
if (typeof arg === 'string') {
for (const ln of arg.split('\n')) {
this.terminal.writeln(ln);
}
} else if (typeof arg === 'number') {
this.terminal.writeln(yellow(String(arg)));
} else if (typeof arg === 'object' && typeof arg.stack === 'string') {
// Error object
for (const line of arg.stack.split('\n')) {
this.terminal.writeln(line);
}
} else {
this.terminal.writeln(String(arg));
}
}

This enhancement is to find or build a library for doing that pretty-printing for us in the browser.

@carnesen carnesen added this to the 0.6.0 milestone Jul 4, 2020
@carnesen carnesen added the website Pertains to @carnesen/cli-website label Jul 4, 2020
@carnesen carnesen modified the milestones: 0.6.0, Backlog Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
website Pertains to @carnesen/cli-website
Projects
None yet
Development

No branches or pull requests

1 participant