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
[WIP] Colorize file generation #906
Conversation
@@ -8,7 +8,7 @@ end | |||
|
|||
gem 'i18n' | |||
|
|||
gem 'hanami-utils', '~> 1.1', require: false, git: 'https://github.com/hanami/utils.git', branch: '1.1.x' | |||
gem 'hanami-utils', '~> 1.1', require: false, git: 'https://github.com/hanami/utils.git', branch: 'coloured_output' |
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.
Temporary, until this branch is merged in.
if OPERATION_COLORS.key?(operation) | ||
_colorize_and_justify(operation) | ||
else | ||
operation.to_s.rjust(COLUMN_WIDTH) |
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.
We could just colorize other stuff to black, to get rid of this conditional.
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.
@cllns This assumes a black terminal background.
@cllns This feature is just great to have, but it comes with the cost of changing all the specs under My suggestion is to:
Snippet 1# config/environment.rb
Hanami.configure do
# ...
cli colorize: false
end |
👍 |
Here's a work-in-progress for colorizing the CLI commands:
You can see what changes will be necessary to the CLI specs. It's a lot of manual work (or could be automated) but it'll cause a lot of diff noise, and make it much harder to edit the output of the specs in the future.
We (@jodosha and I) have talked about extracting the file generation commands into
hanami/cli
. If we did that, then we could test these exact CLI things, without repeating the shellcodes a bunch of times in this repo. We could even write a helper to strip the shellcodes, if we wanted.Thoughts? @jodosha @hanami/core?