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

Added defaultCommand and getDefaultCommand methods #90

Merged
merged 1 commit into from
Jun 26, 2023
Merged

Added defaultCommand and getDefaultCommand methods #90

merged 1 commit into from
Jun 26, 2023

Conversation

tal7aouy
Copy link
Contributor

@tal7aouy tal7aouy commented Jun 25, 2023

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.

@adhocore
Copy link
Owner

btw we can already assign some command as default i believe, did you encounter any problem or usability issue with that?

@tal7aouy
Copy link
Contributor Author

tal7aouy commented Jun 25, 2023

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
Copy link
Owner

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

Copy link
Contributor Author

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

Copy link
Owner

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. :)

Copy link
Contributor Author

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?

Copy link
Owner

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__

@adhocore
Copy link
Owner

thanks for the PR. may i ask to check the recent comment

@adhocore adhocore merged commit 963fc8b into adhocore:main Jun 26, 2023
@adhocore
Copy link
Owner

@tal7aouy, merged it. releasing new ver soon. btw if you find this little thing useful/helpful, please leave a star ⭐ in the repo. thanks 👍

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

Successfully merging this pull request may close these issues.

2 participants