You can configure the shell to add your own commands or run an initialization script.
You can also add functionality at run-time using the register command, see the list of commands.
On startup the Shell will search for a script named '.vfsshellrc'. It will first look in the current working directory, if it does not find the file it will look in the location specified by the java.home environment variable.
This script is not a Beanshell script but a proper VFS Shell script containing the commands available to the shell. Typically you use this to set some variables or to initialize the directory stack to your favorites.
You can also register new commands from classes or scripts. With this you can add new functionality or create shortcuts for often used commands or combinations of commands.
#set environment variables set desktop=file:///c:/Documents\ and\ Settings/auser/Desktop set myfiles=file:///d:/users/me/files #push some locations on the directory stack pushd -n $desktop pushd -n . #add custom commands register org.vfsutils.shell.commands.Ls --name=dir --type=class register scripts/*
If you want to add your custom commands, completely replace the CommandRegistry, change the prompt or do any other customization you can do so in a Beanshell script that should be placed in the classpath.
If you want to use another script you can use an environment variable:
If you want to avoid the script to load you should set the value of environment variable to 'none':
The script is a Beanshell script which has access to the variable 'engine'.
import org.vfsutils.shell.commands.Ls; Ls dir = new Ls(); dir.setCommand("dir"); dir.setLongListType("dos"); dir.register(engine.commandRegistry);
Logging is not enabled by default, but you can use the listener interface for this. There are currently two different options.
The LoggingEngineEventListener writes to the standard logging. The RecordingEngineEventListener writes the given input and thus acts as a recorder.
engine.addEngineEventListener(new org.vfsutils.shell.events.RecordingEngineEventListener(engine.pathToFile("file://d:/temp/cli/out.log"), engine));