Skip to content

[Command] Add question helper for unknown or ambiguous commands #19282

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

Closed
wants to merge 1 commit into from

Conversation

hason
Copy link
Contributor

@hason hason commented Jul 4, 2016

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #16261
License MIT
Doc PR

t

@fabpot
Copy link
Member

fabpot commented Jul 4, 2016

Without looking at the code, I cannot understand the difference between CommandNotFoundException and UnknownCommandException.


public function __construct($namespace, $alternatives = array(), $code = null, $previous = null)
{
$this->command = $namespace;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo $this->namespace = $namespace;

@chalasr
Copy link
Member

chalasr commented Jul 11, 2016

👍 It would be nice to have this.

IMO having several exception classes could be avoided here. Adding an utility method to the CommandNotFoundException that formats the message based on alternatives (i.e. "Did you mean...") should be enough.


if ($alternatives) {
if (1 == count($alternatives)) {
$message .= "\n\nDid you mean this?\n ";
Copy link
Contributor

@ogizanagi ogizanagi Jul 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt the exception should format the message rendered in the console itself. Instead, consumers should build the formatted message IMO.

@fabpot
Copy link
Member

fabpot commented Mar 22, 2017

@hason Can you take comments into account and rebase? Thanks.

@fabpot
Copy link
Member

fabpot commented Jul 6, 2017

Closing as there is no feedback. Feel free to reopen whenever it is ready.

@fabpot fabpot closed this Jul 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants