macports-base icon indicating copy to clipboard operation
macports-base copied to clipboard

show if the port is installed in the info and the search command

Open ra1nb0w opened this issue 4 years ago • 8 comments

This is a small enhancement that I found useful: it adds an [installed] tag in the info and search command. In the info the tag is shown only with the heading print. In the search the tag is shown only in multiline print.

Can be also useful to implement it in the other modes? Maybe, they are used only in scripting and therefore you can call port installed Can be also useful to take in account the active status?

ra1nb0w avatar May 22 '21 08:05 ra1nb0w

Hm, I think this could be slightly misleading because the version shown must not be the version that is installed.

raimue avatar May 22 '21 16:05 raimue

Yes @raimue. I thought about that but [installed] should be only an indication that the port is installed without referring to which version but you are right, can be slightly mislead. Use [upgradable] if a new version is available? What do you think?

ra1nb0w avatar May 23 '21 06:05 ra1nb0w

I mean we could go crazy and show a label for every pseudoport that this port belongs to. [installed] [outdated] [active] [leaf] [obsolete] [requested]

ryandesign avatar May 24 '21 03:05 ryandesign

@ryandesign sarcastic? Since I mainly use search and info my starting idea was to show there if a package is installed or not without calling installed (just like apt*). Nothing too complicated (also to avoid slowdown).

ra1nb0w avatar May 24 '21 05:05 ra1nb0w

Just some brainstorming on this idea. I would suggest not to put even more stuff into the first line. How about adding another line for this information instead?

$ port info dummy
dummy @1.2 (security, net)
State: installed, active, requested, outdated (@1.1_3)
Variants: universal
...

But not sure whether State: uninstalled makes sense? Probably better to leave it out in this case?

In port search it could be shown in an abbreviated form to keep the format concise. Unfortunately, "outdated" and "obsolete" cause a collision on the first letter... But as of now, port search would not show obsolete ports anyway, so it should be clear enough.

$ port search dummy
dummy @1.2 (games) [iaro]
    Just a dummy port

raimue avatar May 24 '21 15:05 raimue

I'm definitely supportive of the general idea!

mascguy avatar May 24 '21 15:05 mascguy

For info can be a good idea to move to a new line with full State (maintain the same UI) except uninstalled. In this case hide the line. For search: I don't like abbreviations since you need to know it and since the command is used by anyone it should be auto-explanatory. Just one point: is not too much cpu intensive checks the full state in the search since it can be quite big?

ra1nb0w avatar May 25 '21 05:05 ra1nb0w

Could you maybe use symbols similar to what Homebrew does (though only for dependencies)?

  • green ✔ or ✓ for installed
  • red ✘ or ✗ for

They're much easier to notice that just the words

eugenesvk avatar Jan 14 '23 17:01 eugenesvk