[nodejs]Hide cursor in CLI

1,051 views
Skip to first unread message

jason.桂林

unread,
Apr 24, 2012, 10:28:05 AM4/24/12
to nod...@googlegroups.com
I want to write a CLI program, but I got a little problem

var x = 0; setInterval(function(){ process.stdout.write('\r' + (++x)) }, 10)

I wrote this simple program , how to hide cursor in CLI?
--
Best regards,

Jason Green
桂林

Ryan Schmidt

unread,
Apr 24, 2012, 10:33:50 AM4/24/12
to nod...@googlegroups.com

On Apr 24, 2012, at 09:28, jason.桂林 wrote:

> I want to write a CLI program, but I got a little problem
>
> var x = 0; setInterval(function(){ process.stdout.write('\r' + (++x)) }, 10)
>
> I wrote this simple program , how to hide cursor in CLI?

That's a shell programming question, not a node question.

http://www.unix.com/shell-programming-scripting/176837-bash-hide-terminal-cursor.html

jason.桂林

unread,
Apr 24, 2012, 10:35:51 AM4/24/12
to nod...@googlegroups.com
Many node CLI program.

2012/4/24 Ryan Schmidt <googl...@ryandesign.com>:
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

Ryan Schmidt

unread,
Apr 24, 2012, 10:36:33 AM4/24/12
to nod...@googlegroups.com
I guess there are node modules to help you do this. Here's an example of someone using cursor.hide() and cursor.show(), where cursor is obtained from require('ansi').

https://gist.github.com/2299368

There's also node-ncurses which has showCursor.

https://github.com/mscdex/node-ncurses

etc.

jason.桂林

unread,
Apr 24, 2012, 1:34:23 PM4/24/12
to nod...@googlegroups.com
Thanks very much

2012/4/24 Ryan Schmidt <googl...@ryandesign.com>:
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en



Reply all
Reply to author
Forward
0 new messages