Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Implement a standard (command) extensibility mechanism #40

Open
jachinte opened this issue Sep 12, 2016 · 0 comments
Open

Implement a standard (command) extensibility mechanism #40

jachinte opened this issue Sep 12, 2016 · 0 comments

Comments

@jachinte
Copy link
Collaborator

jachinte commented Sep 12, 2016

Amelia allows replacing the built-in commands with method calls returning CommandDescriptor objects. However, it is not totally integrated with the language. A good option for more command-like extensibility would be allowing the user to define its own commands. It wouldn't be much difference with regard to the current implementation, although a new kind of statement or type declaration should be introduced. For instance:

subsystem Test {
    define postgres (String action, String db, String user, String pass): [ 
        return Utility.execOnPostgres(action, db, user, pass)
    ]
    define ls (String directory): [
        return Commands.generic("ls " + directory);
    ]
    ...
    on host {
        init:
            postgres "start" "postgres" "1234"
            ls "/tmp"
    }
}

Also a good thing would be to remove the need for using quotes to specify command arguments, although that can be difficult to validate (because of grammar ambiguities).

@jachinte jachinte changed the title Implement a standard extensibility mechanism Implement a standard (command) extensibility mechanism Sep 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant