Skip to content

Conversation

@afomera
Copy link
Member

@afomera afomera commented Sep 30, 2025

👋 Hiya!

Caution

This PR is draft, I'm looking for feedback on this and only the hanami new command 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

  • Updated the new command output to use the Formatter class

Hanami::CLI::Files class

  • New def created_directory(path) method for, you guessed it, announcing it created a directory.
  • Updated mkdir(path) method to use the created_directory method to announce it in the proper formatting.

Questions

  • Does this align with the vision? I normally would probably consider using a method but it seemed apt to make a Formatter class 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 CleanShot 2025-09-29 at 18 27 53@2x

TODO

  • Add specs (can't live with em, can't live without em).
  • Test other commands + fix specs

@timriley timriley moved this to Consider in Hanami 2.3 Oct 18, 2025
@afomera afomera force-pushed the afomera/pretty-hanami-new-command branch from ef581e6 to 2528a66 Compare October 24, 2025 02:33
@afomera afomera marked this pull request as ready for review October 24, 2025 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Consider

Development

Successfully merging this pull request may close these issues.

1 participant