Konzole
Console applications in NodeJS made easy as hell.
Usage
Require a konzole
within a simple node script and run it:
var konzole = 'MY FIRST CONSOLE' "1.0.0";konzole;
you will see an help script describing the commands that are registered
within this console (only help
, for now).
Let's declare a new ls
command that will simply console.log
the
contents of a directory:
var konzole = 'MY FIRST CONSOLE' "1.0.0";var kommand = ;var fs = ;var ls = 'Lists contents of a directory';ls {console};konzole;konzole;
et-voila:
Options
To add options to your command, simply declare them as dependencies of your command:
var kommand = ;var kommand = ;var ls = 'Lists contents of a directory' 'd' 'dir' '.';ls {console};
the three arguments of an option are:
- its name (
-d
) - its alias (
--dir
) - its default value (
.
)
Now you can simply use your pimped command with node index.js ls --dir=/home/you/something
.
Example console
In this example we are adding to the console
the already-seen ls
command and a new, quote
,
command that will retrieve a random quote from the
internet.
Just like that.
var konzole = 'MY FIRST CONSOLE' "1.0.0";var kommand = ;var option = ;var fs = ;var colors = ;var _ = ;var HTTP = ;var ls = 'Lists contents of a directory' 'd' 'dir' '.';ls {var directory = input;console;};var quote = 'Retrieves a random quote';quote {HTTP};konzole;konzole;konzole;
Have fun!
Tests
Gimme some time :)