Cakephp: Remove "Welcome to Cake..." banner for cake console commands.

Created on 6 Jul 2017  Â·  30Comments  Â·  Source: cakephp/cakephp

  • [x] enhancement

  • CakePHP Version: 3.3.7

  • Platform and Target: 7.0.18-0ubuntu0.16.04.1

What you did

Ran bin/cake

What happened

Output:

Welcome to CakePHP v3.3.7 Console
---------------------------------------------------------------
App : src
Path: /var/www/vhosts/xxxxx/htdocs/src/
PHP : 7.0.18-0ubuntu0.16.04.1
---------------------------------------------------------------

This banner makes working with the console a bit dirty, as it is output with each command.

What you expected to happen

Can we save this output for bin/cake version output? Or for a special info command option?

console enhancement

Most helpful comment

Please don't remove the default welcome message. It's a good indicator to beginners that their shell is working, and gives important environment information. Perhaps the better solution is to include how to remove it in the documentation?

All 30 comments

I agree with this. The description should be removed.

The shell library of cake is too tasteless. I think the it should be re-implemented, see symfony/console;

@notoriousturtle seems reasonable to me, though I think you can currently override a method to remove this from your own shells.

The shell library of cake is too tasteless. I think the it should be re-implemented, see symfony/console;

@slince This sort of feedback isn't very useful as there isn't a list of changes/enhancements that we can act upon. Do you have specific feedback that we can work with?

@slince see #10716

@josegonzalez

  • Support for custom route for the command.
    The command like './cake foo_bar_baz foo_bar' lacks beauty.

  • Increase flexibility
    The library helped the developer do too much

$this->createFile('bower.json', $stuff);

I cannot replace the default prompt if the target file exists. Perhaps this right should be given to the developer

  • Remove the prefix "_"
$this->_io->out('foo');
  • If I execute a nonexistent command, the output will make me wonder.
>cake user_binding non_exists

Welcome to CakePHP v3.4.9 Console
---------------------------------------------------------------
App : src
Path: C:\www\slshop\src\
PHP : 5.6.19
---------------------------------------------------------------
Usage:
cake user_binding [-h] [-q] [-v]

Options:

--help, -h     Display this help.
--quiet, -q    Enable quiet output.
--verbose, -v  Enable verbose output.

You know, I need an accurate tip. like git.

>git commmit
git: 'commmit' is not a git command. See 'git --help'.

Did you mean this?
        commit

Please don't remove the default welcome message. It's a good indicator to beginners that their shell is working, and gives important environment information. Perhaps the better solution is to include how to remove it in the documentation?

@slince

Support for custom route for the command

Already exists, just not documented in the book (https://api.cakephp.org/3.4/class-Cake.Console.ShellDispatcher.html#_alias)

Increase flexibility

CakePHP doesn't force you to use any thing, you can create your own custom prompt if you want

Remove the prefix "_"

The prefix is part of the CakePHP coding standards for protected properties.

If I execute a nonexistent command, the output will make me wonder.

You need to create the correct options/help using https://book.cakephp.org/3.0/en/console-and-shells.html#configuring-options-and-generating-help
CakePHP can't guess what you mean :)

You know, I need an accurate tip. like git.

Open a Pull Request :)

Please don't remove the default welcome message. It's a good indicator to beginners that their shell is working, and gives important environment information. Perhaps the better solution is to include how to remove it in the documentation?

@dakota include it in bin/cake version, or in the help command. Outputting this banner on each command makes reviewing output difficult, and just plain dirty. Most products do not output a banner like this on each command. New users should consult the docs if they cannot work out how to run bin/cake version, or help, which are basically the first commands you run when running a new CLI based app.

With the version shell thing now available everywhere that verbose block could indeed be a bit overkill now.
We could keep it for the default bin/cake (which is what people use to check if console works) as long as no shell or shell action is invoked yet for example :)

@dakota

Already exists, just not documented in the book

Any basic usage? I cannot find it in the cookbook.

CakePHP doesn't force you to use any thing, you can create your own custom prompt if you want

How to change default prompt of the method $this->createFile ?

The prefix is part of the CakePHP coding standards for protected properties.

The coding standard should be advancing with the times. You know psr does not encourage this

You need to create the correct options/help using...

Sorry i cannot write any help message for an non-exists command. I think shell dispatcher should throw exception or display a friendly message.

@slince Please do not hijack tickets again for your own agenda and topics completely unrelated to the issue mentioned here.
This is disrespectul towards that person and the community as it shifts the focus completely away, making the actual discussion disappearing between your off-topic discussion :/

So please stop now - right here.

@slince - Last comment on this to stop the hijack, but I need to respond to you.

  1. Like I said, it's not documented in the book. Follow what the API says. When you've figured it out, I hope we'll see a PR from your to document it.
  2. You can't change the default prompt of createFile(), but you can write you own. Again, please open a PR if you'd like to see this.
  3. The coding standard does advance with the times. Unfortunately, you can't just go and rename all properties and methods and expect to keep BC.
  4. Like I said, open a PR

Back to topic.

@notoriousturtle It's very simple to replace the banner with your own one if you want to :)

I'm with @dereuromark on this. The banner could be displayed on bin/cake or help command only.

It's very simple to replace the banner with your own one if you want to :)

@dakota yeah, I understand that, but in all I honestly think this is going to be better for the end user if its moved to bin/cake, version, or say an info parameter. Cleaner to use :)

Please don't remove the default welcome message.

@dakota ah, its worth mentioning, I may have interpreted this wrong. Either you meant leave it in every cake command output, or just in cake somewhere (e.g. no parameters as suggested by @dereuromark). The latter of which I agree with.

@dereuromark @dakota

Sorry, the issue is about the shell. so i did not create a new issue.

Just my personal opinion。。。

As for the original PR I think a --no-welcome would do?

@ionas Dont add any more non functional arguments :) We already discussed a viable solution above IMO.

That's what you say but I am with @dakota that it shows version and path by default to newbies for any command. However I can live with both easily (V) :)

@ionas look at the proposed solution. bin/cake to output this. You do not need it in every command.

@notoriousturtle Are you able to make PR with the suggestion change? That might solve this the quickest way :)

I'm ok with removing the default welcome message from all userland/core shells and only leaving it on the default bin/cake --help which is what (bin/cake resolves to).

extra label/message must remove from userland code
but for core shells that can be remove when config.debug is false and remain when config.debug is true

@saeideng Why the different behavior here? Just doing what @markstory just confirmed should be enough.

Please don't remove the default welcome message. It's a good indicator to beginners that their shell is working, and gives important environment information.

we using core shells just during develop , not for product time
extra info for core shells is optional and can be remove or remain
but for product time must remove all extra info/message IMO

@saeideng I think it will be simpler if the welcome message is removed from all shells other than help. This will make the behaviour consistent and predictable. Is anyone able to put together a pull request for this?

@markstory @dereuromark I'll look into in the next couple days.

Resolved with https://github.com/cakephp/cakephp/pull/10879
Thanks for all the contribution and feedback!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

inoas picture inoas  Â·  3Comments

tersmitten picture tersmitten  Â·  3Comments

micdobro picture micdobro  Â·  3Comments

caBBAlainB picture caBBAlainB  Â·  4Comments

Erwane picture Erwane  Â·  3Comments