Skip to content
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

Clean up console script and use OOP approach instead of Procedural approach #3

Open
isocroft opened this issue Dec 20, 2016 · 1 comment

Comments

@isocroft
Copy link
Owner

No description provided.

@isocroft
Copy link
Owner Author

isocroft commented Dec 20, 2016

Will be using the Console, Prompt, ArgvInput and ArgcInput classes in /system/provider/Tools/ folder to implement this. See jollof file in the project root for more info on implementation design;

This code structure should be borne in mind while implemeting this. "Providers\Tools\Console" will be a class with a static method "setCommand". This static method will take only 2 arguments - a string (the name of the command) and a callable (The function that houses what will happen when the command is called on the CLI).

The second argument (callable) will have one argument (an instance of class Providers\Tools\Prompt) which will serve to interact with the CLI via it's methods.

Providers\Tools\Console::setCommand('make:env', function($prompt){
   
           $stdInData = array(); 
           $stdOuts = array('db_host=','db_user=', 'db_password=');
   
           $tokens = $prompt->getArguments();
   
           $prompt->read($stdInData, $stdOuts);
   
           $prompt->write('All Done.');
 });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant