-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganize the CLI structure ? #9
Comments
Commands should extend the abstract class, which is a generator and requires the implementation of the necessary functionality. |
Over the weekend I will work on it |
I'm currently a little busy with other tasks |
maybe something similar? abstract class Command {
/// hint for console
String get hint;
/// validate command line arguments
bool validate();
/// execute command
Future<void> execute();
}
class ExampleCommand extends Command {
String get hint => throw UnimplementedError();
@override
bool validate() {
// TODO: implement validate
throw UnimplementedError();
}
@override
Future<void> execute() {
// TODO: implement execute
throw UnimplementedError();
}
}
void main() {
final commands = {
'create': {
'example': () => ExampleCommand(),
}
};
final hints = {
'create': {
'example': ExampleCommand().hint,
}
};
// find command by arguments
final command = commands['...']['...']();
// print errors
if (command.validate()) {
command.execute();
}
} |
I am very grateful for your help |
@CpdnCristiano I have implemented the api I suggested. Where can I show an idea? this is from a clean project |
if you want you can create a repository on github |
very good, I liked it a lot I will implement it as soon as possible |
implemented some of your tips |
I propose to reorganize the CLI structure, there are not many functions yet.
it would be wise to store commands in the map
running the command can generate multiple files
Motivation:
The text was updated successfully, but these errors were encountered: