Clear the screen in Gremlin Console?

320 views
Skip to first unread message

Jon Schoenfield

unread,
Jun 12, 2019, 4:43:39 PM6/12/19
to Gremlin-users
I'm running Gremlin Console (on a laptop running Windows 10).  If I want to clear the screen (similar to what the "cls" command normally does in a Command Prompt window), is there an easy way to do that?

If not ... is there a not-so-easy way that probably wouldn't be difficult for someone like me (just getting started with Gremlin)?

Thanks!

Stephen Mallette

unread,
Jun 12, 2019, 5:38:57 PM6/12/19
to gremli...@googlegroups.com
i don't know of a way to do that. the gremlin console is built on groovysh which in turn uses jline2 for io stuff, so we are a bit dependent on them for that kind of functionality (perhaps there is a way and i'm just not aware). not sure if there is a OS specific way to do it (cls wouldn't work i guess) but, as an example, I learned the ctrl+u on linux is good to delete all contents of a line in the Gremlin Console - never realized that worked there before the same way it works from the regular command line.

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/50ef4bac-cd54-4574-b671-99f9d3364008%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Kuppitz

unread,
Jun 12, 2019, 5:49:13 PM6/12/19
to gremli...@googlegroups.com

Jon Schoenfield

unread,
Jun 12, 2019, 6:38:24 PM6/12/19
to Gremlin-users
Okay, thanks.  So far, the best I've been able to come up with is

     Alt+Spacebar E L PageDown Enter

... which seems like a lot to do just to clear the screen.  :-(


On Wednesday, June 12, 2019 at 4:38:57 PM UTC-5, Stephen Mallette wrote:
i don't know of a way to do that. the gremlin console is built on groovysh which in turn uses jline2 for io stuff, so we are a bit dependent on them for that kind of functionality (perhaps there is a way and i'm just not aware). not sure if there is a OS specific way to do it (cls wouldn't work i guess) but, as an example, I learned the ctrl+u on linux is good to delete all contents of a line in the Gremlin Console - never realized that worked there before the same way it works from the regular command line.

On Wed, Jun 12, 2019 at 4:43 PM 'Jon Schoenfield' via Gremlin-users <gremli...@googlegroups.com> wrote:
I'm running Gremlin Console (on a laptop running Windows 10).  If I want to clear the screen (similar to what the "cls" command normally does in a Command Prompt window), is there an easy way to do that?

If not ... is there a not-so-easy way that probably wouldn't be difficult for someone like me (just getting started with Gremlin)?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremli...@googlegroups.com.

Jon Schoenfield

unread,
Jun 12, 2019, 6:47:05 PM6/12/19
to Gremlin-users
Thanks!  I didn't even know there was a "Groovy Console" ....

Unfortunately, when I tried Ctrl+W at the "gremlin>" prompt (in the Command Prompt window in which I had started an instance of Gremlin Console), it just showed

     gremlin> ^W
     gremlin>


On Wednesday, June 12, 2019 at 4:49:13 PM UTC-5, Daniel Kuppitz wrote:
CTRL+L in Linux and, according to https://www.davidtan.org/how-to-clear-screen-in-groovy-console/, CTRL+W in Windows.

Cheers,
Daniel


On Wed, Jun 12, 2019 at 2:38 PM Stephen Mallette <spmal...@gmail.com> wrote:
i don't know of a way to do that. the gremlin console is built on groovysh which in turn uses jline2 for io stuff, so we are a bit dependent on them for that kind of functionality (perhaps there is a way and i'm just not aware). not sure if there is a OS specific way to do it (cls wouldn't work i guess) but, as an example, I learned the ctrl+u on linux is good to delete all contents of a line in the Gremlin Console - never realized that worked there before the same way it works from the regular command line.

On Wed, Jun 12, 2019 at 4:43 PM 'Jon Schoenfield' via Gremlin-users <gremli...@googlegroups.com> wrote:
I'm running Gremlin Console (on a laptop running Windows 10).  If I want to clear the screen (similar to what the "cls" command normally does in a Command Prompt window), is there an easy way to do that?

If not ... is there a not-so-easy way that probably wouldn't be difficult for someone like me (just getting started with Gremlin)?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremli...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremli...@googlegroups.com.

Fabio Lorenzi

unread,
Jun 13, 2019, 4:49:56 AM6/13/19
to Gremlin-users
You might want to try the same combinations with the WindowsKey+L or WindowsKey+W (much like the cmd in MacOs).
I'm just dropping ideas, I have no means to try it out but it is worth a shot

Jon Schoenfield

unread,
Jun 13, 2019, 12:06:31 PM6/13/19
to Gremlin-users
I hadn't thought of that....
I tried WindowsKey+L, and it locked the screen (so I entered my password to unlock it) ...
I tried WindowsKey+W, and it brought up Windows Ink Workspace (which I may want to look into at some point) ...
I also tried WindowsKey+[letter] for each of the other letters on the keyboard, and none of them cleared the screen in the Gremlin Console instance ...
... but I did learn some shortcut key combinations that I found useful!  :-)
Thanks!

Kelvin Lawrence

unread,
Jun 25, 2019, 2:46:15 PM6/25/19
to Gremlin-users
Ctrl-W generates the same escape sequence that 

gremlin>"cmd /c cls".execute.text

generates I think but neither ever seem to work for me. Your menu shortcut key sequence beats anything I have found on Windows. I mostly use Mac and Linux where CTRL-L works fine as others have noted. If you can live with a cleared screen with the prompt still at the bottom this hack works:

gremlin> def cls() {for (i in 1..100){println(" ")};[]}
gremlin cls
()

Jon Schoenfield

unread,
Jun 28, 2019, 11:26:25 AM6/28/19
to Gremlin-users
Thanks!  Just to see what would happen, I tried

gremlin> "cmd /c cls".execute.text

and it responded with

No such property: execute for class: java.lang.String
Type ':help' or ':h' for help.
Display stack trace? [yN]

... Is that the result I should expect?

I then tried

gremlin> def cls() {for (i in 1..100){println(" ")};[]}
gremlin cls
()

and that worked fine -- except that, as you said, the prompt is still at the bottom of the screen.  But I can get used to that.  :-)

Thanks again!

Kelvin Lawrence

unread,
Jun 28, 2019, 10:08:01 PM6/28/19
to Gremlin-users
Sorry that was a typo on my part - it should be execute()

Kelvin

Kelvin Lawrence

unread,
Apr 1, 2020, 4:31:15 PM4/1/20
to Gremlin-users
This came up again on SO [1] so I did some more experimenting. With the Console in local mode, on recent Windows 10 versions, this will clear the screen.

Stephen Mallette

unread,
Apr 2, 2020, 9:06:20 AM4/2/20
to gremli...@googlegroups.com
thanks Kelvin - as a result of what you wrote I created:


It works nicely on ubuntu in bash. Would you mind building this branch:


and testing it out? Perhaps, there is a windows user out there who might be able to test as well to confirm it works?



To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/ff72fa1d-1cc1-4845-99a1-c881499a081d%40googlegroups.com.

Kelvin Lawrence

unread,
Apr 2, 2020, 10:41:55 AM4/2/20
to Gremlin-users
Hi Stephen , tried building the gremlin-console project on that branch but the file ResetCommand.groovy does not seem to be in the repo n that branch 

Cheers
Kelvin

Stephen Mallette

unread,
Apr 2, 2020, 1:07:41 PM4/2/20
to gremli...@googlegroups.com
sorry - i messed up the commit. it should be fixed now.

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/af379546-a8bd-4ea4-b20a-065d051488ae%40googlegroups.com.

Kelvin Lawrence

unread,
Apr 2, 2020, 1:19:56 PM4/2/20
to Gremlin-users
Built and tested on Linux (Red Hat)

I can try Mac and Windows later

Minor comment the long name :reset may imply it does more then clear the screen. How about something like :clscreen

Kelvin


On Thursday, April 2, 2020 at 12:07:41 PM UTC-5, Stephen Mallette wrote:
sorry - i messed up the commit. it should be fixed now.

Stephen Mallette

unread,
Apr 2, 2020, 1:25:15 PM4/2/20
to gremli...@googlegroups.com
how about :cls and shorthand as :C ?

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/1287df4b-622b-4a94-9f02-898e575860d1%40googlegroups.com.

Kelvin Lawrence

unread,
Apr 2, 2020, 1:30:29 PM4/2/20
to Gremlin-users
Works for me :-)

Kelvin


On Thursday, April 2, 2020 at 12:25:15 PM UTC-5, Stephen Mallette wrote:
how about :cls and shorthand as :C ?

Kelvin Lawrence

unread,
Apr 2, 2020, 7:33:17 PM4/2/20
to Gremlin-users
Tested fine on Mac. Will get to Windows ASAP unless anyone beats me to it.

Kelvin

Yeikel

unread,
Apr 2, 2020, 7:51:42 PM4/2/20
to gremli...@googlegroups.com
I can confirm that it works fine on Windows (Windows 10)

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/c22c75f8-713f-44d7-b4ff-b79460c326cd%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages