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

Console improvements #12438

Merged
merged 2 commits into from
Dec 9, 2022
Merged

Console improvements #12438

merged 2 commits into from
Dec 9, 2022

Conversation

brandonkelly
Copy link
Member

Description

Adds new methods to craft\console\Controller for outputting nicely-formatted notes, etc:

  • note()
  • success()
  • failure()
  • tip()
  • warning()

Example:

$message = <<<EOD
**This is a success message!**
The operation was a complete success!
EOD;

$this->success($message);
✅ This is a success message!
   The operation was a complete success!

There’s also a new do() method, which takes a callback method, and outputs info before and after the callback is executed:

$this->do('Doing the thing', function() {
    // ...
});
 → Doing the thing … ✓

Finally, there’s new file-handling methods (which call do() internally):

  • createDirectory()
  • writeToFile()
  • writeJson()

@brandonkelly brandonkelly requested a review from a team as a code owner December 9, 2022 18:19
[ci skip]
@brandonkelly brandonkelly merged commit 127c017 into develop Dec 9, 2022
@brandonkelly brandonkelly deleted the feature/console-methods branch December 9, 2022 18:44
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.

1 participant