-
Notifications
You must be signed in to change notification settings - Fork 278
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
Add vorpal.ui.clear
command to API
#134
Comments
Thanks. The API on this changed a bit since that post. Could you possibly paste your code? |
hi, here's my code in my 'use strict';
module.exports = (vorpal, config) => {
return vorpal
.command('clear', 'Clear the outputs.')
.action(function(args, cbk) {
let blank = '';
for (var i = 0; i < process.stdout.rows; ++i) {
blank += '\n';
}
vorpal.ui.redraw(blank);
vorpal.ui.redraw('');
cbk();
});
}; |
It will be very nice that |
For sure! In the immediate, check out this for a much better way to solve your problem! https://github.com/dthree/cash/blob/master/src/commands/clear.js |
Cool! Thanks so much! I'm confused on the |
@mamboer: It's ANSI escape codes. A breakdown of
|
No problem. I'm renaming this issue to turn it into a feature request. |
Just to point out the ansi-escapes package which implements a clearScreen method and many other useful sequences. |
Hey guys am using this command to 'clean' the screen , especially after a messy execution : |
@Maxtoros nice idea! |
I just tried this on Windows 10 and it exits my app completely. Any ideas? |
@JimmyBoh I used Windows 10 while working with my solution ( ConEmu with 2 tabs : Cygwin Bash + CMD) |
@JimmyBoh probably What exactly exits your app? Is there an exception? |
@Maxtoros exact recommendation: vorpal
.command('clean')
.action(function (args,cb) {
process.stdout.write ("\u001B[2J\u001B[0;0f");
cb();
}); There was no exception, it just instantly cleared everything and exiting the vorpal context (returned back to regular |
I actually just tried the same thing with |
hi,
I implemented a
clear
command in one of my vorpal application following your answers in this post http://stackoverflow.com/questions/8813142/clear-terminal-window-in-node-js-readline-shell/32871585#32871585?newreg=0fd7e6b366544c72b82496cd4c077973The problem is that the cursor lost in the console after executing the
clear
command, as the screenshots below:Before
clear
,After
clear
,Notice that the grey cursor had gone.
The text was updated successfully, but these errors were encountered: