Wicked Shell

So you found this wicked blog and you might have noticed it is located at www.wickedshell.net. Wicked Shell is my tiny little plugin for the Eclipse IDE – check it out you most certainly will find it useful…

What is Wicked Shell?

Before I start to explain how Wicked Shell works, I'd like to take a word about what Wicked Shell is and what not. Wicked Shell is an eclipse plugin which functions as mediator between a Runtime process and a SWT Text widget. That means the output of the Runtime process is transferred to the widget and the text typed in the widget is transferred to the process as input. So Wicked Shell is not an actual shell but only uses an existing shell implementation.

Overview of functionality

As I said, Wicked Shell is an eclipse plugin. After installation, your eclipse distribution offers two more views. The Shell – View provides the access to the used shell implementation. You see the output of the shell and you can type your commands. As a funky feature, a command completion is provided. There are different types of completions.

  • Active folder completions

    These completions are computed by inspecting the active folder for executable files.

  • System path completions

    These completions are computed by inspecting the system path.

  • Static completions

    These completions are static and may be adjusted in the Preferences Page.

  • Cascading completions

    These completions are computed depending on a command or folder prefix entered as command.

You may configure on the preferences page which entries are suggested in the command completion. If the shell reports errors, these are additionally printed to the ShellErrorDisplay which can be open from the Shell – View's menubar. The menubar as well offers action to restart the current shell or open an additional Shell – View.

The second view is the Batch Files – View which offers a quite simple list to manage often used executables. These files may be listed here and then directly executed in the Shell – View. You may also define parameters for execution. The Batch – View shows also the content of the selected batch file in the list.

Support and Feature Requests

Wicked Shell works pretty well, from my point of view:-). But there might be something missing to make it suitable for you. If so, do everyone a favour and post a feature request. To do that, go here . If you find any bugs, please report it as well at Sourceforge. Any other comments (even positiv ones) are welcome as well.

Getting started

Download

The fact that you read this manual states that you have already discovered the Wicked Shell project home at http://sourceforge.net/projects/wickedshell/. But anyway, this section is mandatory in a manual, isn't it? OK, the binaries and sources of the Wicked Shell eclipse plugin are available at the download area. In the future, an update site will be available.

Installation

You may easily install Wicked Shell via updatesite at http://www.wickedshell.net/updatesite. If you installed an update of Wicked Shell (e.g. from 2.0.4 to 2.0.5), you might find it necessary to start your eclipse worbench with the -clean parameter the first time after installation. If you discover a SerialisationException on startup, please file a bug with the error text, I know the problem and I'll try to help. I haven't found a solution to avoid that phenomenon though.

Wicked Shell

After the startup of your eclipse distribution, you'll find the two views described in the introduction. If you want to adjust the command completion or select another shell to be used instead of the default shell for your OS, just use the preferences page. Currently, only Windows is 'really' supported. I wrote a Shell descriptor for Linux bash as well, but it is not well tested. Therefor, for Linux in particular, I am always happy to get feedback, even positiv.

If you decide to select a different Shell than the default, please ensure it to be installed.

Cygwin and MSYS

Choosing another shell

Wicked Shell uses a default shell for different OS. Currently, this is bash for Linux and Cmd.exe for Microsoft Windows. Additionally, Cygwin and MSYS can be used with Wicked Shell when using Microsoft Windows. To do so, open the preferences page and select the shell you want. For Linux, only bash is currently provided.

Configuration

When using Cygwin or MSYS, a little speciality comes in. Both consider their installation directory as the system's root directory. Therefor you need to define this installation directory at the preferences page. It's necessary as Wicked Shell needs this information for providing a command completion.

Cygwin as well as MSYS allows configure the style of the prompt. Both use as well as the common Linux bash the environmental value PS1. If you leave this value at it's default, Wicked Shell's ShellView will look quite funny as there will occur ASCII escape characters which cannot be displayed by the SWT Text widget. So you need to define a Wicked Shell compatible prompt in order to get a readable prompt and have a command completion. There are a couple of options you can choose, I myself prefer a two line prompt: One to display all my favorite information which I am used from my Linux bash like time, user and host. The second line provides the necessary information for Wicked Shell. The current full path and the separator '& ' which both are required as last line. To define the PS1 value simply type
PS1=\\t' '\\u'@'\\H\\r\\n\\w' $ '
as command in the ShellView, this will result in the prompt described above. Please refer to the manual for bash/sh for other prompt content. You might as well automate the setting of the prompt. With Cygwin, just add the PS1 definition to the .bashrc file in your cygwin user's home directory. MSYS allows the editing of the profile file in the etc folder of the MSYS root so you just add the PS1 definition there.

Extension Points

Why offer an Extension Point ?

Well, the first feature request, that came in, were requests for other shells to be integrated. So what could be better than enable everyone to integrate his or her favorite shell. Defining a so called descriptor for your own shell is quite easy, lets have a look.

Shell Descriptors

I mentioned it before, Wicked Shell is not a real shell. To make the text transfer work, both streams, input – and outputstream, need to be configured. This configuration is called ShellDescriptor. Wicked Shell offers the extension point net.sf.wickedshell.shell to define a descriptor. A ShellDescriptor consists of different information. First of all, there are different parsing parameters like the character that marks the end of the shell's prompt, the path delimiter of the shell or if the shell provides a UI line feed within it's output captured by Wicked Shell.

Furthermore each shell requires different handling of special topics. For example, at cmd.exe, a change of directory requires setting the right drive. So a ShellDescriptor always references classes that implement specific interfaces and fulfill these tasks.

In the next few lines, we'll take a closer look on the different attributes of ShellDescriptor.

  1. Attribute ID

    The attribute ID represent the unique identifier for the shell descriptor. The ID is used to store specific information for the shell described.

  2. Attribute name

    The attribute name defines a human readable name for the shell described. The name should be unique in order to allow to differ between the shells. The name is initially displayed in the title section of the ShellView.

  3. Attribute executable

    The attribute executable defines the executable which launches the shell. The string must contain the corresponding command and all additional suffixes (e.g. cmd.exe /c) . It must not contain any path information.

I know, that these information are not really a complete manual for Wicked Shell, but it is all I got to write down. Don’ hesitate to ask me any questions left. Simply write an email to stefanatwickedshell.net and I’ll try to respond as soon as I can.

Join the Conversation

9 Comments

  1. Hi kraeMit,

    Du kannst mit den Pfeiltasten(hoch/runter) durch Deine bereits abgegebenen Befehle navigieren. Zusätzlich kannst Du die Liste der abgegebenen Befehle über das View-Menu exportieren.

    Viele Grüße,
    Stefan

  2. The active folder completion window does not show files within the active folder, it only shows folders.
    I was wondering if I am doing smth wrong or missing smth.

  3. Can you debug your shell scripts with Wicked Shell with eclipse or is there a debugger out there with a different name for debugging shell scripts with cygwin?

  4. Hi Chris,
    Wicked Shell does not support debugging as it only passes on the commands from the UI to the process. As I am not really into working with cygwin I don’t know about any debugging tool for cygwin.
    Regards,
    Stefan

  5. Hi,

    I can’t seem to invoke the path completion as I do in my regular Linux Bash terminal window. What is the procedure for doing so in Wicked Shell? I would normally use the the TAB key.

    Thanks,

    Don

  6. Hi,
    This plugin for Eclipse is a sweet tool, kudos to you Stefan!!
    I’m having an issue with the perl interpreter on WickedShell. If I invoke the perl interpreter without any input and try to stop its execution with Ctrl+C, WicketShell will not kill it as it would happen if I do it with the cmd.exe directly. I think this might also happen with any other executable that goes into an infinite loop. Is there a fix/workaround for this?

    Thanks,
    Luis

  7. Hi Luis,

    thanks, good to hear you like Wicked Shell.
    Unfortunately, Ctrl+C does not work, as the communication with the underlaying process (the perl interpreter) is text based via Input- OutputStream. Therefor it does not recognize these keys and prints them as text. You can only restart the shell view.

    Best Regards,
    Stefan

Leave a comment

Your email address will not be published. Required fields are marked *