-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Added defaultCommand and getDefaultCommand methods #90
Conversation
btw we can already assign some command as default i believe, did you encounter any problem or usability issue with that? |
I saw add method pass default but i think it's good if we create a command not default and wanna change it later so we need to make it as default |
* | ||
* @return string|null The name of the default command, or null if not set | ||
*/ | ||
public function getDefaultCommand(): ?string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there might be always a default command i think as it is set in constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just use it as a getter to get the default command cauz i need it in test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no i mean about the nullable string in return type. can be just string i guess. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah maybe but if command is not default it's should return null right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't default set in construct already? __default__
thanks for the PR. may i ask to check the recent comment |
@tal7aouy, merged it. releasing new ver soon. btw if you find this little thing useful/helpful, please leave a star ⭐ in the repo. thanks 👍 |
I add two new methods, defaultCommand and getDefaultCommand, to the Application class. These methods allow for setting and retrieving the default command of the application.
The defaultCommand method sets the default command by accepting the name of the command as a parameter. It throws an
InvalidArgumentException
if the specified command name does not exist in the application.The getDefaultCommand method returns the name of the default command if it is set, or null if no default command is set.
These methods provide more flexibility and control over the default command behavior in the application.
Please review this pull request at your convenience. Thank you.