ninxsoft / mist-cli

A Mac command-line tool that automatically downloads macOS Firmwares / Installers.
MIT License
620 stars 29 forks source link

Sort JSON keys in output and export #80

Closed n8felton closed 2 years ago

n8felton commented 2 years ago

It appears that Mist does a good job at sorting the output by version from newest to oldest, however, it would be nice if the keys were also sorted, or at least consistent. It's hard to glance at the JSON when the keys are always "jumbled."

mist list installer 12 --output-type json --export macos12.json --quiet

stdout

[
  {
    "version" : "12.4",
    "size" : 12109915349,
    "date" : "2022-05-24",
    "identifier" : "012-06873",
    "name" : "macOS Monterey",
    "build" : "21F79"
  },
  {
    "date" : "2022-04-11",
    "name" : "macOS Monterey",
    "identifier" : "002-79225",
    "size" : 12231889911,
    "version" : "12.3.1",
    "build" : "21E258"
  },
  {
    "version" : "12.3",
    "date" : "2022-03-14",
    "build" : "21E230",
    "identifier" : "071-08758",
    "size" : 12229608829,
    "name" : "macOS Monterey"
  },
  {
    "date" : "2022-02-17",
    "identifier" : "002-66265",
    "name" : "macOS Monterey",
    "size" : 12161433208,
    "version" : "12.2.1",
    "build" : "21D62"
  }
]

macos12.json

[
  {
    "identifier" : "012-06873",
    "name" : "macOS Monterey",
    "build" : "21F79",
    "size" : 12109915349,
    "date" : "2022-05-24",
    "version" : "12.4"
  },
  {
    "build" : "21E258",
    "identifier" : "002-79225",
    "size" : 12231889911,
    "name" : "macOS Monterey",
    "date" : "2022-04-11",
    "version" : "12.3.1"
  },
  {
    "size" : 12229608829,
    "name" : "macOS Monterey",
    "version" : "12.3",
    "build" : "21E230",
    "date" : "2022-03-14",
    "identifier" : "071-08758"
  },
  {
    "identifier" : "002-66265",
    "version" : "12.2.1",
    "date" : "2022-02-17",
    "build" : "21D62",
    "size" : 12161433208,
    "name" : "macOS Monterey"
  }
]
ninxsoft commented 2 years ago

Looks like I was missing the sortedKeys flag: e7fc289

stdout:

[
  {
    "build" : "21F79",
    "compatible" : true,
    "date" : "2022-05-25",
    "identifier" : "012-06873",
    "name" : "macOS Monterey",
    "size" : 12109915349,
    "version" : "12.4"
  },
  {
    "build" : "21E258",
    "compatible" : true,
    "date" : "2022-04-12",
    "identifier" : "002-79225",
    "name" : "macOS Monterey",
    "size" : 12231889911,
    "version" : "12.3.1"
  },
  {
    "build" : "21E230",
    "compatible" : true,
    "date" : "2022-03-15",
    "identifier" : "071-08758",
    "name" : "macOS Monterey",
    "size" : 12229608829,
    "version" : "12.3"
  },
  {
    "build" : "21D62",
    "compatible" : true,
    "date" : "2022-02-18",
    "identifier" : "002-66265",
    "name" : "macOS Monterey",
    "size" : 12161433208,
    "version" : "12.2.1"
  }
]

monterey.json:

[
  {
    "build" : "21F79",
    "compatible" : true,
    "date" : "2022-05-25",
    "identifier" : "012-06873",
    "name" : "macOS Monterey",
    "size" : 12109915349,
    "version" : "12.4"
  },
  {
    "build" : "21E258",
    "compatible" : true,
    "date" : "2022-04-12",
    "identifier" : "002-79225",
    "name" : "macOS Monterey",
    "size" : 12231889911,
    "version" : "12.3.1"
  },
  {
    "build" : "21E230",
    "compatible" : true,
    "date" : "2022-03-15",
    "identifier" : "071-08758",
    "name" : "macOS Monterey",
    "size" : 12229608829,
    "version" : "12.3"
  },
  {
    "build" : "21D62",
    "compatible" : true,
    "date" : "2022-02-18",
    "identifier" : "002-66265",
    "name" : "macOS Monterey",
    "size" : 12161433208,
    "version" : "12.2.1"
  }
]
PicoMitchell commented 2 years ago

I see you got rid of the check for at least 10.13 when including the sortedKeys option in Dictionary+Extension though, which you'll want to keep and also include in Sequence+Extension since that option is only available on 10.13 and newer (if you want to keep supporting back to 10.10).

Or maybe you're dropping some old OS support before macOS 13 comes out?

ninxsoft commented 2 years ago

Definitely leaning towards dropping macOS 10.13 and macOS 10.14 support, especially so close to macOS 13 beta releasing.

Certain frameworks, used in validating downloads and resuming downloads, are only compatible with macOS 10.15 and newer.

Latest three operating systems + beta should be enough for most users - users can also use older versions of mist if they so desire 👍