Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huntlabs/hunt-console
Hunt Console creation easier to create powerful command-line applications.
https://github.com/huntlabs/hunt-console
command command-line console hunt
Last synced: 5 days ago
JSON representation
Hunt Console creation easier to create powerful command-line applications.
- Host: GitHub
- URL: https://github.com/huntlabs/hunt-console
- Owner: huntlabs
- Created: 2018-12-25T15:06:52.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-29T10:05:04.000Z (about 3 years ago)
- Last Synced: 2024-08-04T01:04:05.881Z (4 months ago)
- Topics: command, command-line, console, hunt
- Language: D
- Homepage:
- Size: 103 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-d - hunt-console - Hunt console creation easier to create powerful command-line applications. (Command Line / XML)
README
Console Component
=================Console eases the creation of beautiful and testable command line interfaces.
It is a port from [Symfony's Console component](https://github.com/symfony/Console).
The Console object manages the command-line application:
import hunt.console;
console = new Console();
console.run(new ArgsInput(args));The ``run()`` method parses the arguments and options passed on the command
line and executes the right command.Registering a new command can easily be done via the ``register()`` method,
which returns a ``Command`` instance:```D
void main(string[] args)
{
Console app = new Console("Hunt Console", "1.0.0");
app.setAutoExit(false);
app.add(new GreetingCommand());app.add((new Command("test")).setExecutor(new class CommandExecutor {
override public int execute(Input input, Output output)
{
output.writeln("hello world");
return 0;
}
}));
app.run(args);
}
```You can also register new commands via classes.
The component provides a lot of features like output coloring, input and
output abstractions (so that you can easily unit-test your commands),
validation, automatic help messages, ...