Improve CLI Output, with a Formatter class #326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
👋 Hiya!
Caution
This PR is draft, I'm looking for feedback on this and only the
hanami newcommand has been tested so far, some output in other commands may not look quite right. Once we determine the approach I'll work on coordinating updating the other commands / testing them.This is the first stab at an incremental approach to improving the CLI Output to look nice and appealing for users using it.
Following the discussion in hanami/roadmap#11 I wanted to take a try at this and see if I could get my feet involved and put the code to the metal.
Additions
Hanami::CLI::Formatter class
Meant to be private internal, but provides us with an interface to take some text and some semantic methods (success, warning, info, heading) and get back ANCI format codes + text.
Changes
Hanami::CLI::Commands::Gem::New
Hanami::CLI::Files class
def created_directory(path)method for, you guessed it, announcing it created a directory.mkdir(path)method to use the created_directory method to announce it in the proper formatting.Questions
Formatterclass and methods that can be used with the existing out.puts code since it's just putting the text and needing color codes.Screenshots
Details
TODO