command 0.0.1
A lightweight framework for designing interactive CLI applications
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
This package provides sub packages which can be used individually:
command:lib - A lightweight framework for designing interactive CLI applications
command:grammar - Generator for the command grammar
command:varstore - A minimal D application.
command
This is a simple command-line framework that I devised while writing a "very secret" project.
Status
Currently, this package has not been published on the dub
repository. Subject to change.
Design Goals:
- Lightweight
- Minimal dependencies (only 1!!)
- Portable
- Parser reads in from stdin, but that's easy to change & make better
- Easy to use
- The use of UDAs here helps a ton
Examples
class TestExample {
@CommandNamespace("test"):
// name, description, min args, max args
@Command("hello", "Hello, World!", 0, 0)
string hello(string[] args) {
return "Hello, World!";
}
@Command("user", "Say hello to someone!", 1, 1)
string hello_user(string[] args) {
return "Hello, " ~ args[0] ~ "!";
}
}
mixin RegisterModule!TestExample;
then, in the CLI:
> test.hello
Hello, World!
> test.hello()
Hello, World!
> test.user("Foo")
Hello, Foo!
TODO:
- Proper return types
- Avoid using strings as a type everywhere
- Small standard library for ease of use
- No user-defined functions however
- By design, we're not trying to be a scripting engine
- No user-defined functions however
- Well-defined instantiation order
- In the end, this won't matter (since you can't call until the engine has been fully initialized), but might be worth investigating
- Command history
- Registered by Harrison Ford
- 0.0.1 released 4 years ago
- hatf0/command
- proprietary
- Copyright © 2020, Harrison Ford
- Authors:
- Sub packages:
- command:lib, command:grammar, command:varstore
- Dependencies:
- command:lib, command:grammar
- Versions:
-
0.0.8 2020-Nov-23 0.0.7 2020-Nov-07 0.0.6 2020-Nov-07 0.0.5 2020-Nov-07 0.0.4 2020-Nov-07 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
28 downloads total
-
- Score:
- 0.6
- Short URL:
- command.dub.pm