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

Add support for verbosity flags to run commands #1

Open
kralos opened this issue Nov 11, 2014 · 2 comments
Open

Add support for verbosity flags to run commands #1

kralos opened this issue Nov 11, 2014 · 2 comments
Assignees

Comments

@kralos
Copy link
Member

kralos commented Nov 11, 2014

When running tempo -v <command> we should see output from the $node->run($cmd); calls.

This will probably require re-architecture of the way nodes use Process.

Adding support for multi-threaded $node->run($cmd) from the Command will also affect this re-architecture.

@kralos kralos self-assigned this Nov 11, 2014
@zomble
Copy link
Contributor

zomble commented Nov 12, 2014

What route are you going down?

In my mind I'm thinking about an Output object that is aware of verbosity with in write or writeln or better yet some interface that extends OutputInterface that introduces writeVerbose() etc.

Then the example would be something like:

$hostname = $node->run('something but I don't care about the output, unless verbose');
$output->writeln($hostname, VERBOSE);
// or
$output->writeVerbose($hostname);

Obviously if I never cared about the output unless it failed, just $node->run('something that I don't care about unless it fails');

I did think about injecting Output into Node (thus wrapping Process->getOutput() directly), but I feel like it shouldn't care. Since in all the examples it's the programmer that cares.

Not thought about multi-threaded node->run() you'll have to walk me through it.

@kralos
Copy link
Member Author

kralos commented Nov 12, 2014

Output is already aware of verbosity, see https://github.com/symfony/Console/blob/master/Output/OutputInterface.php#L58 I'm just considering hooking the output stream from the Process to the OutputInterface. This is really handy for debugging when you are writing Commands / Tasks etc to see what is actually happening. A solution I have been considering is exposing the underlying Process object from the Node\Remote however that would mean the user would need to understand the underlying implementation (unlike a Node\Local where the command is executed as the process, a Node\Remote actually streams the user's command into the STDIN of an ssh process)

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

2 participants