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

[Proposal] Modify output behavior; optional newlines and icons #108

Closed
philip opened this issue Jan 13, 2018 · 5 comments
Closed

[Proposal] Modify output behavior; optional newlines and icons #108

philip opened this issue Jan 13, 2018 · 5 comments
Labels

Comments

@philip
Copy link

philip commented Jan 13, 2018

Applications are finding different ways to insert newlines into messages. The two ways I've seen thus far in real-world Laravel Zero apps:

$this->error("\nFoo\n");
$this->line('');
$this->error('Foo');
$this->line('');

Neither approach seems ideal. Could there be a better way? The following feels right:

$this->error('Foo');

Related and while we're here, what if we could also (optionally) enable icons for these? For example, maybe info() could be configured to prepend (i) or similar so these stand out a little more. For my use case, app output includes stdout from Process commands so prepending icons to Laravel Zero output could make it stand out a bit.

All thoughts and idea improvements are welcome :)

@nunomaduro
Copy link
Member

nunomaduro commented Jan 14, 2018

Thanks @philip for this proposal. Since I understood, you propose the following features:

@philip
Copy link
Author

philip commented Jan 19, 2018

I see that PR references newLine() although I still think it feels wrong to write this:

$this->newLine();
$this->error('Foo');
$this->newLine();

Instead of:

$this->error('Foo');

This request was hoping we could optionally automagically wrap output for these commands with newlines without having to add the extra clutter.

@nunomaduro
Copy link
Member

@philip What do you mean exactly about that? Because if I type:

        $this->error('First error');
        $this->error('First error');

I will get:
screenshot 2018-01-19 20 45 14

@philip
Copy link
Author

philip commented Jan 19, 2018

@nunomaduro Some people want more whitespace. Here are two Laravel Zero applications in the wild that indicate this:

This wraps with line(''):
https://github.com/jeffochoa/twitter-cli/blob/master/app/Commands/Tweet.php#L63

This wraps with \n:
https://github.com/tightenco/lambo/blob/lampho/app/Commands/NewCommand.php#L96

@nunomaduro
Copy link
Member

@philip I understand your point of view. I am ok with the ->newLine option. Thanks anyway! 👍

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

No branches or pull requests

2 participants