Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.6
-
Fix Version/s: 1.8.3, 1.9-beta-4, 1.7.11
-
Component/s: Groovysh
-
Labels:None
-
Number of attachments :
Description
In GroovySh class, the renderPrompt() method wich define the shell prompt is private.
It would be great if this method become public so that the users could define their own prompt and customize their shell.
Took this change beyond the requested change. I did the following actions:
1. Changed the renderPrompt() method to be public
2. Refactored renderPrompt() to call a private method called buildPrompt().
The buildPrompt() method builds the groovy shell command prompt name in 1 of 3 ways:
1. Checks the groovysh.prompt property passed into groovysh script. -Dgroovysh.prompt="hello"
2. Checks an environment variable called GROOVYSH_PROMPT. export GROOVYSH_PROMPT
3. If no value is defined returns the default groovy shell prompt.
The code will always assume you want the line number in the prompt. To not have the numbers in the prompt, you
can simply override the renderPrompt() method.
If anyone has questions, comments or concerns about how I implemented the change or would like to see it implemented differently let me know.
Thanks,
John