WLST provides an interactive mode in which you enter a command and view the response at a command-line prompt. Interactive mode is useful for learning the tool, prototyping command syntax, and verifying configuration options before building a script

When entering commands interactively, you want to minimize typing and quickly correct any mistakes. In this blog entry, I summarize the various command line editing options available in WLST in Windows and Unix environments.

Windows environment

When running on a Windows system, WLST uses the Windows command shell for the WLST console. The Windows shell provides a number of keys that can be used to edit and recall commands. There are the common keys:



  • LEFT ARROW and RIGHT ARROW to move within a command

  • HOME and END to move to the start and end of a command

  • UP ARROW and DOWN ARROW to move within the command history




But there are also useful keys that are not as well known



  • F7 shows a dialog box with the command history

  • F8 walks backwards through the command history, but only displays commands that match the text to the left of the cursor

  • CTRL LEFT ARROW and CTRL RIGHT ARROW to move to the next or previous word in a command




The following link provides a good description of all of the keys supported by the Windows shell

http://www.microsoft.com/technet/scriptcenter/topics/winpsh/manual/hotkeys.mspx




Unix environment

In a Unix environment, WLST does not provide any command line editing capabilities. However, you can use a 3rd party tool like JLine to provide line editing in WLST.

JLine provides the following editing capabilities:



  • Command history

  • Line editing

  • Custom key bindings




For more information about JLine refer to http://jline.sourceforge.net/index.html

To use JLIne with WLST, follow these steps.



  1. Download JLine from http://jline.sourceforge.net/downloads.html

    Unzip the file and put the jline jar (current version is jline-0.9.94.jar) into a directory on your machine.

  2. Add the jline jar (current version is jline-0.9.94.jar) to the CLASSPATH

  3. Run JLine as follows

    java jline.ConsoleRunner weblogic.WLST

  4. Alternatively, you can copy the $WL_HOME/common/bin/wlst.sh and then add jline.ConsoleRunner before weblogic.WLST




The default keys in JLine are:



  • UP ARROW and DOWN ARROW to move within the command history

  • CTRL-N and CTRL-P to move within the command history




  • LEFT ARROW and RIGHT ARROW to move within a command

  • CTRL-B moves to the previous character

  • CTRL-G moves to the previous word

  • CTRL-A moves to the beginning of the line




  • CTRL-F moves to the next character

  • CTRL-E moves to the end of the line




  • CTRL-U deletes all characters before the cursor

  • CTRL-W deletes the word before the cursor




See the JLine documentation for information on customizing the key bindings using the keybindings.properties file.