command 0.0.3

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:greeter - A minimal D application.

command

This is a simple command-line framework that I devised while writing a "very secret" project.

Status

This library is still in-dev.

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
  • 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
Authors:
  • Harrison Ford
Sub packages:
command:lib, command:grammar, command:varstore, command:greeter
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
Show all 9 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 28 downloads total

Score:
0.6
Short URL:
command.dub.pm