-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Add decorator to brew info $pkg
dependency list to indicate Dependency#installed?
#18922
Conversation
Sounds cool. |
This could be the automatically selected option when the |
Please, let's avoid the proliferation of unicode output, optional or otherwise. |
Create an external command that does this |
Why, exactly? I'm pretty sure Terminal has Unicode support. I doubt it really matters anyway. Pretty much everything nowadays had Unicode support. On Apr 3, 2013, at 12:57 AM, Jack Nagel [email protected] wrote:
|
On what versions of OS X? (This is rhetorical). Please look through the threads about the beer emoji. Stuff like this has disproportionate maintenance costs. If this is really necessary, the deps should just be colored differently, but I'm ambivalent about even that. Someone should just make a |
Given we have the environment variable and to hide unicode and show it otherwise on every brew install I'm actually up for using more unicode where it displays more information in a single character. Whether it does in this case or not I'm not sure. |
So, direction. I need it. Suggestions:
I'd like to do this:
I feel that № 1 is within scope of this PR. № 2 is a useful idea show dependencies and their status, with an eventuality to resolve the dependency tree, if such a command doesn't already exist. Ultimately, I'll do whatever you all think is appropriate for the project. |
I think probably a separate (external) command for now perhaps makes more sense. Open to other ideas from other maintainers though. |
I like it. And think it's very useful. Why you against it @jacknagel? It would be necessary to detect non-tty and output with plainer text though I should think. |
I've stopped caring and checked out of this thread because nobody seems to care that Homebrew is going to look like a cartoon soon. Do whatever. |
I care. That's why I brought up the |
Who cares, really? Programs evolve based on the wishes of their users. If you don't like where Homebrew is going, use another tool. On Apr 6, 2013, at 1:57 PM, Jack Nagel [email protected] wrote:
|
Please do this as an external command so we can test drive it before we decide whether or not to put it into core. |
For the record, I'm -1. I'd like to see a core set of brew commands that do simple machine readable output, sort of like the porcelain levels of Git, and a set of command on top, or separate UI packages on top, that do the "angry clown salad" thing (think tig). |
It remains machine readable as-is; just relies on unicode characters. I think it's actually a good call in cases like this where a single unicode character communicates more than any non-unicode one does. |
I agree. On Apr 7, 2013, at 5:50 PM, Mike McQuaid [email protected] wrote:
|
I've taken action to respect
This is my primary motivation for using a single unicode character. It seems that it would already be wise for a machine-reading program to set I will endeavor to submit in a separate pull request a new command |
I'm glad Unicode characters are being used. This was a good decision. On Apr 7, 2013, at 6:38 PM, Colin Dean [email protected] wrote:
|
Somehow with colors and dingbats the output of It is already hard to read (prior to this proposal) because the list of deps is a comma-separated list and isn't columnized. The part under "Depends on:", whether colorized or dingbatized or not, should be like the output of Also, it isn't true in this case that a single unicode character is conveying more than any non-unicode one. E.g., what's wrong with good ol' |
@chdiza The "dingbats" stand out and give a bit of visual appeal. |
Any additional thoughts or direction on this? |
I'll have a look. |
def decorate_dependencies dependencies | ||
#necessary for 1.8.7 unicode handling since many installs are on 1.8.7 | ||
checkmark = Tty.green + ["2714".hex].pack("U*") + Tty.reset | ||
xout = Tty.red + ["2718".hex].pack("U*") + Tty.reset |
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.
What does xout
mean?
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.
It means cross out or just X. I didn't want to use a single letter variable that seemed more likely to evoke this very same question.
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.
Maybe name them tick
and cross
?
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.
I'm not sure that those are any more indicative of their use or content, since it's difficult to determine what character is assembled by the code there. I'd considered using yes
and no
, but then it'd be just as difficult to determine the character.
Maybe remove the coloring from there and rename xout
to crossout
. I think of ✝ when I think of cross. Then, have another variable set that adds the color to the characters. This makes it a little easier to read. Or, pulling those into a function would allow easier overriding for custom settings.
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.
cross_out
sounds good.
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.
I'll update it here and on my other PR.
This works for me but I'll wait for a +1 from another maintainer. |
Changed |
I'm now -0 on this since I can turn it off with the EMOJI env var. If @MikeMcQuaid is still OK with this, this needs to be rebased on master for review. |
Interestingly enough, I'm planning to work on that rebase tonight... |
Cool. Let's rebase and I'll get on it. |
* replace simple join output with decorator method * define default decorator method * default decorator method shows green check if installed or red X if not * only highlight dependency if HOMEBREW_NO_EMOJI is set
Rebased. Interestingly enough, I found a bug caused by this comment's additions and fixed it, too. |
@MikeMcQuaid Any other feedback? I'd like to get this in before I have to do another big rebase ;-) |
@colindean Will review properly ASAP. |
Pushed. Thanks @colindean. |
Thanks, folks! |
I've started getting an error from this: Trace:
|
I think this PR #24188 should fix the undefined method error |
* shows green tick if installed or red cross if not * only highlight dependency if HOMEBREW_NO_EMOJI is set Closes Homebrew#18922. Signed-off-by: Mike McQuaid <[email protected]>
References Homebrew#18922. Closes Homebrew#24188. Closes Homebrew#24190.
* shows green tick if installed or red cross if not * only highlight dependency if HOMEBREW_NO_EMOJI is set Closes Homebrew#18922. Signed-off-by: Mike McQuaid <[email protected]>
References Homebrew#18922. Closes Homebrew#24188. Closes Homebrew#24190.
Using a decorator method here enables a user to override Homebrew#decorate_dependencies with whatever they desire. I like the green checkmark and red X, so I offer them for the default. An simpler, less unicode-y alternative would be to simply highlight the dependency package name in the given color.
My personal motivation here is to use the indication as a factor in determining if I want to install a package right now. If I look at a package's info and see that none of its dependencies are installed, and installing them may take a while, I may reconsider installing that package right now if I'm on battery or if I'm doing something that CPU or disk usage from compiling may negatively affect.
Future work would include a similar decorator for conflicting packages, displaying some kind of a warning character if a conflicting package is installed.