Skip to end of metadata
Go to start of metadata

Except the batch mode, which is same as how one executes ant build file, Neptune supports interactive shell so that one can experiment Neptune commands and Ant tasks.

Starting up Neptune Interactive

In order to run Neptune in interactive mode, type in the following command in your operating system shell:

And you'll see:

Where the ">" is the prompt for commands.

There are other command line options that apply to the interactive mode, such as specifying an alternative working directory, specifying log file etc. You can run "np -h" to see all the command line options. We'll not try to cover the details here.

This interactive Neptune shell has the same look and feel of the Jaskell Shell. You can find more information about Jaskell shell here. The only differences are:

  1. prelude functions are not at the top level to avoid naming clashes. You need to use "jaskell.prelude.map" or "jaskell.prelude.fold" to reference the prelude map or fold function.
  2. An extra "exec" function is provided to run Neptune commands or ant tasks. By default, Ant tasks and Neptune commands evaluate to jfun.neptune.Command without actually being executed. The "exec" function executes the command.

Now let's look at a few examples.

Echo

To run a simple echo, one can type in:

Or, we can break it into steps:

This creates a function that we can use to call echo task.

we then can run the echo task more concisely:

Rename files

It is sometimes desirable to rename files recursively in a directory. Yet the Windows "rename" command doesn't have support for this.

In Neptune, we can use the ant "Move" task to do the work.

First, let's create a function to simplify the syntax for ant Move task:

This defines a function "rename" that does file renaming recursively.

We can now call this function to rename files, for example:

Ant helper functions

Actually the "rename" and "echo" functions are already defined in the "jfun/neptune/ant/anthelper.jsl" file. We can simply import this file using the "import" function:

The "import" function will load the anthelper.jsl file in as a tuple (namespace). We then can call the echo and rename functions as:

and

Labels
  • None