Dux Released

I decided that dux was good enough to publish. Go check it out.

Basic Usage

At it’s core dux is a flexible container that accepts drop in functionality that can be executed from a common command line interface. Adding new commands or extending others is straight forward and simple. This is a very different mindset from build oriented tools like jake or ant. These tools focus on files, directories, and processing. dux is a simple command line utility that wraps logging and option parsing so it can be extended by other commands.

Let’s start off with a very simple example of how to use dux.

var dux = require('dux');

dux.commands.add('say', function () {
    dux.logger.info('Saying ' + this.args.join(' '));
});

dux.start();

Executing this command is as simple as throwing it at as an argument.

$ node example.js say Hello World!
info:     Welcome to Dux
info:     It works if it ends with Dux ok
info:     Executing command path say Hello World!
info:     Saying Hello World!
info:     Dux ok

You can add a shebang to the top of the file and give it executable permissions to clean up the execution.

$ ./example.js say Hello World!
info:     Welcome to Dux
info:     It works if it ends with Dux ok
info:     Executing command path say Hello World!
info:     Saying Hello World!
info:     Dux ok

Influence

I took a lot of influence from jitsu and npm. The stylized cli logging and exit conditions are especially useful when writing an application. This repackaging allows anyone to build their own npm or jitsu style tool, without the overhead of logging and command usage.

written December 19th, 2011

December 2011

Can’t find what you’re looking for? Try hitting the home page or viewing all archives.