hexpm / hex

Package manager for the Erlang VM

Home Page:https://hex.pm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feature request] Sort `mix hex.outdated` output by status in default output

kianmeng opened this issue · comments

Is it possible to sort by default the mix hex.outdated output by Status instead of Dependency column?

The default:

$ mix hex.outdated
Dependency              Current  Latest  Status
absinthe                1.7.5    1.7.5   Up-to-date
absinthe_error_payload  1.1.4    1.1.4   Up-to-date
absinthe_plug           1.5.8    1.5.8   Up-to-date
absinthe_relay          1.5.2    1.5.2   Up-to-date
appsignal               2.7.9    2.7.11  Update possible
appsignal_phoenix       2.3.4    2.3.4   Up-to-date
aws_auth                0.7.2    0.7.2   Up-to-date
broadway_cloud_pub_sub  0.7.1    0.9.0   Update not possible

Something like below:

Dependency              Current  Latest  Status
appsignal               2.7.9    2.7.11  Update possible
broadway_cloud_pub_sub  0.7.1    0.9.0   Update not possible
absinthe                1.7.5    1.7.5   Up-to-date
absinthe_error_payload  1.1.4    1.1.4   Up-to-date
absinthe_plug           1.5.8    1.5.8   Up-to-date
absinthe_relay          1.5.2    1.5.2   Up-to-date
appsignal_phoenix       2.3.4    2.3.4   Up-to-date
aws_auth                0.7.2    0.7.2   Up-to-date
...

Or the Status column moved to the far left:

Status              Dependency              Current  Latest
Update possible     appsignal               2.7.9    2.7.11
Update not possible broadway_cloud_pub_sub  0.7.1    0.9.0
Up-to-date          absinthe                1.7.5    1.7.5
Up-to-date          absinthe_error_payload  1.1.4    1.1.4
Up-to-date          absinthe_plug           1.5.8    1.5.8
Up-to-date          absinthe_relay          1.5.2    1.5.2
Up-to-date          appsignal_phoenix       2.3.4    2.3.4
Up-to-date          aws_auth                0.7.2    0.7.2
...

We have noticed that we kept using this command mix hex.outdated | grep "Update possible" to filter out the ouput. Since this mix task is to find out all outdated deps, it would make sense to put those pending update deps at the top of the list.

What do you think?

IMO I could see two changes:

  1. group the deps into statuses visually - possibly use a flag and keep the current view as default
  2. add flags to filter by status mix hex.outdated --update-possible

Anyone else have strong opinions?

Adding a sort option sounds good to me. I'd hold off on adding filter though as it's easy to grep:

$ mix hex.outdated | grep "Update possible"