This form may be used for quick copy/paste Flywheel tasks. List of items goes on the top left, edit the template on the top right, results will appear at the bottom. Try some of the samples, to get an idea of how much easier some of your tasks can be.

Flywheel

Panopset Flywheel is a freeform text template processor.

There are many ways to use Flywheel, for example:

  • On the web, for quick copy paste tasks. (Click the "Got it!" button above left, to go back to the online Flywheel form, to try it out.)
    • Since panopset.com itself is on a cheap server with no guaranteed availability, you are encouraged to host your own for ensured availability.
  • As a JavaFX application, called using the traditional way, from an all-in-one jar. You will need to download or build panopset.jar, for your system.
  • As a JavaFX application, called using the Java 9 Jigsaw way. You will need to build that from source.
  • Called directly from your own Java applications. You could do this using panopset.jar, or build just what you need (flywheel and compat modules) from the source.

The best way to think about designing your templates, is to always keep in mind that you never have to define anything twice.

Four General Flywheel Commands

These general Flywheel commands are available in both the web, and application versions of Flywheel.

Push

Push defines a variable. All the freeform templates, text, and other commands to follow until its matched quit command will be available as its defined variable to subsequent commands.

${@p foo}bar{@q}

Anything in between the push command, and its matching quit command, are defined as a variable, foo in the above example, which will be available in all subsequent commands and templates called.

List

In the Flywheel web app, you only get one list, the top left list text area. In the Flywheel desktop app, you may use as many lists as you like, to drive processing.

${@l relpath}

relpath is a path to a list, relative to the main template parent directory. In our nginx use case, go.txt is driven by the sites.txt list.

Quit

Partners with the File, Push, and List commands to complete them, allowing for all the freeform creativity you can come up with.

${@q}

The template processor will add un-matched quit commands if necessary, but if a quit command appears with no matchable command preceding it, flywheel will output an error message and stop.

Variable

The variable command is unique, in that it has no @ symbol to define it as one of the other commands, it is just like a Linux script variable.

${foo}

will output bar, if defined as shown in the Push example above.

Three Additional Application Commands

These commands are not available in the web version, since they either involve desktop files, or custom Java calls.

Template

Templates can call other templates, all freeform.

${@t relpath}

... where relpath is the path relative to the template passed to Flywheel in the first parameter. In our nginx use case, the command would be:

java -cp ~/panopset.jar com.panopset.flywheel.Flywheel go.txt target

... and in this case the template passed is go.txt.

File

This is a path relative to the output directory you specified in calling the Flywheel class.

${@f relpath}everything here gets put in the file.${@q}

You may also specify a variable, as the relpath. In our nginx use case, looking at go.txt again, the variable is 1, which is the first word in the sites.txt list being processed, using the List command.

Execute

This allows you to do anything you like. You have to define your custom executables statically, before calling Flywheel:

ReflectionInvoker.defineTemplateAllowedReflection("getVersion", "com.panopset.compat.AppVersion.getVersion");

Once it is defined, it may be executed with any String parameters comma separated in the parentheses:

${@e getVersion()}

Use case

Panopset

Click anywhere in the image above to advance the slideshow, which demonstrates a typical Flywheel use case.

History

Flywheel was first written using MPW back in 1996. It was moved to Java right around the dawn of Java, and has been refined off and on over the years ever since.