How can I create a task using nexus script

The answer to this will be a useful addition to Advanced Use Cases for the Nexus Repository Manager API