mas icon indicating copy to clipboard operation
mas copied to clipboard

Version pinning / ignoring

Open bosconb opened this issue 4 years ago • 2 comments

Notes

Version pinning is a subset of regex version inclusion/exclusion; pinning ignores all updates (potentially at different semver levels), while version inclusion/exclusion could ignore specific versions or version regexes.

Pinning to the current version would exclude .* regex matches; pinning to 1.x would include only 1\..* regex matches.

e.g., as per #668, it looks like apps can report a version in the local install that is different than the version reported in the Mac App Store for the same release (e.g. 1.1.18 vs. 1.0.0.1.18).

To avoid updates being continually offered from 1.1.18 to 1.0.0.1.18, a user might want to ignore version 1.0.0.1.18.

To simplify things, all version inclusion/exclusion should probably be handled by mas pin <app-id> with mutually exclusive options. While "pin" might not exactly properly linguistically apply to all it would handle, it's close enough, while other terms might cause more confusion than they're worth. From here on, "pin" will be a substitute for "version inclusion/exclusion".

mas unpin <app-id> would remove all existing pins for the specified app.

mas pin with no arguments will displays all pins.

mas pin [--force] (<semver-level-name>|<semver-level-index>|--include <regex>|--exclude <regex>) <app-id>

--force would be required to change an existing pin. If a pin exists for <app-id> but --force wasn't supplied, mas will output an error.

mas pin … <app-id> requires one of the following mutually exclusive argument sets:

  • a single <semver-level-name>: e.g., major, minor, patch, prerelease, etc. (I don't know if the Mac App Store supports prerelease versions, or if mas can work with TestFlight)
  • a single <semver-level-index>: if 1-based, 1 = major, 2 = minor, 3 = patch, etc., because version component depth could be arbitrary (could be 0-based, but 1-based is likely better)
    • only apply to dot-separated decimal number components?
    • don't apply to -<prerelease>?
  • --include <regex>: include only versions that fully match <regex>
  • --exclude <regex>: exclude only versions that fully match <regex>

Original Issue

Please add a mechanism to exclude a list of apps from being output or affected by mas outdated or mas upgrade.

Both a command-line option and a file-based config could be useful, the former for one-off exclusion, the latter for ongoing exclusion.

bosconb avatar May 22 '21 05:05 bosconb

This sounds like version pinning. Something like brew pin seems like it might address this.

We could persist this in a property list.

chris-araman avatar May 28 '21 23:05 chris-araman

Until mas outdated has the ability to suppress unhelpful messages like…

Warning: Identifier XXXXXXXXXX not found in store. Was expected to identify <NAME_OF_APP>.

… I found two ways to handle it in the interim. One is by suppressing stderr:

mas outdated 2>/dev/null

The other way is more "surgical" and allows other warnings and errors to be displayed:

script -q /dev/null mas outdated | grep -v "not found in store"

Hope this is of help to someone. ✨

justinmayer avatar Oct 03 '23 13:10 justinmayer