hugovk / norwegianblue

CLI to show end-of-life dates for a number of products.
https://endoflife.date
MIT License
79 stars 4 forks source link

Refactor output arguments from `--format md` to `--md` etc. #169

Closed hugovk closed 1 year ago

hugovk commented 1 year ago

I thought the CLI might be a bit easier to use if we change the format arguments from things like --format md and -f rst to direct --md and --rst, and so on.

Also group the different formatting options in the --help text.

I've left the old -f/--format options in for now, they print a deprecation warning, and can be removed in a later release.

What do you think?

Before

❯ eol -h
usage: eol [-h] [-f {html,json,md,markdown,pretty,rst,csv,tsv,yaml}] [-c {yes,no,auto}] [--clear-cache] [-v] [-V] [-w]
           [product ...]

CLI to show end-of-life dates for a number of products, from https://endoflife.date

For example:

* `eol python` to see Python EOLs
* `eol ubuntu` to see Ubuntu EOLs
* `eol centos fedora` to see CentOS and Fedora EOLs
* `eol all` or `eol` to list all available products

Something missing? Please contribute! https://endoflife.date/contribute

positional arguments:
  product               Product to check, or 'all' to list all available (default: ['all'])

options:
  -h, --help            show this help message and exit
  -f {html,json,md,markdown,pretty,rst,csv,tsv,yaml}, --format {html,json,md,markdown,pretty,rst,csv,tsv,yaml}
                        The format of output (default: pretty)
  -c {yes,no,auto}, --color {yes,no,auto}
                        Color the terminal output (default: auto)
  --clear-cache         Clear cache before running (default: False)
  -v, --verbose         Print extra messages to stderr (default: 30)
  -V, --version         show program's version number and exit
  -w, --web             Open product page in web browser (default: False)
❯ eol python -f md
| cycle |  release   | latest  | latest release |    eol     |
|:------|:----------:|:--------|:--------------:|:----------:|
| 3.11  | 2022-10-24 | 3.11.4  |   2023-06-06   | 2027-10-24 |
| 3.10  | 2021-10-04 | 3.10.12 |   2023-06-06   | 2026-10-04 |
| 3.9   | 2020-10-05 | 3.9.17  |   2023-06-06   | 2025-10-05 |
| 3.8   | 2019-10-14 | 3.8.17  |   2023-06-06   | 2024-10-14 |
| 3.7   | 2018-06-26 | 3.7.17  |   2023-06-05   | 2023-06-27 |
| 3.6   | 2016-12-22 | 3.6.15  |   2021-09-03   | 2021-12-23 |
| 3.5   | 2015-09-12 | 3.5.10  |   2020-09-05   | 2020-09-13 |
| 3.4   | 2014-03-15 | 3.4.10  |   2019-03-18   | 2019-03-18 |
| 3.3   | 2012-09-29 | 3.3.7   |   2017-09-19   | 2017-09-29 |
| 2.7   | 2010-07-03 | 2.7.18  |   2020-04-19   | 2020-01-01 |
| 2.6   | 2008-10-01 | 2.6.9   |   2013-10-29   | 2013-10-29 |
❯ eol python --format md
| cycle |  release   | latest  | latest release |    eol     |
|:------|:----------:|:--------|:--------------:|:----------:|
| 3.11  | 2022-10-24 | 3.11.4  |   2023-06-06   | 2027-10-24 |
| 3.10  | 2021-10-04 | 3.10.12 |   2023-06-06   | 2026-10-04 |
| 3.9   | 2020-10-05 | 3.9.17  |   2023-06-06   | 2025-10-05 |
| 3.8   | 2019-10-14 | 3.8.17  |   2023-06-06   | 2024-10-14 |
| 3.7   | 2018-06-26 | 3.7.17  |   2023-06-05   | 2023-06-27 |
| 3.6   | 2016-12-22 | 3.6.15  |   2021-09-03   | 2021-12-23 |
| 3.5   | 2015-09-12 | 3.5.10  |   2020-09-05   | 2020-09-13 |
| 3.4   | 2014-03-15 | 3.4.10  |   2019-03-18   | 2019-03-18 |
| 3.3   | 2012-09-29 | 3.3.7   |   2017-09-19   | 2017-09-29 |
| 2.7   | 2010-07-03 | 2.7.18  |   2020-04-19   | 2020-01-01 |
| 2.6   | 2008-10-01 | 2.6.9   |   2013-10-29   | 2013-10-29 |

After

❯ eol -h
usage: eol [-h] [-f {html,json,md,markdown,pretty,rst,csv,tsv,yaml}] [-c {yes,no,auto}] [--clear-cache] [-v] [-V] [-w]
           [--pretty | --md | --rst | --json | --csv | --tsv | --html | --yaml]
           [product ...]

CLI to show end-of-life dates for a number of products, from https://endoflife.date

For example:

* `eol python` to see Python EOLs
* `eol ubuntu` to see Ubuntu EOLs
* `eol centos fedora` to see CentOS and Fedora EOLs
* `eol all` or `eol` to list all available products

Something missing? Please contribute! https://endoflife.date/contribute

positional arguments:
  product               product to check, or 'all' to list all available (default: 'all')

options:
  -h, --help            show this help message and exit
  -f {html,json,md,markdown,pretty,rst,csv,tsv,yaml}, --format {html,json,md,markdown,pretty,rst,csv,tsv,yaml}
                        deprecated: use direct options instead: --html, --json, --md, --pretty, --rst, --csv, --tsv or
                        --yaml.
  -c {yes,no,auto}, --color {yes,no,auto}
                        colour the terminal output (default: auto)
  --clear-cache         clear cache before running
  -v, --verbose         print extra messages to stderr
  -V, --version         show program's version number and exit
  -w, --web             open product page in web browser

formatters:
  --pretty              output in pretty (default)
  --md                  output in Markdown
  --rst                 output in ReStructuredText
  --json                output in JSON
  --csv                 output in CSV
  --tsv                 output in TSV
  --html                output in HTML
  --yaml                output in YAML
❯ eol python -f md
The -f/--format option is deprecated, use direct options instead: --html, --json, --md, --pretty, --rst, --csv, --tsv or --yaml.
| cycle |  release   | latest  | latest release |    eol     |
|:------|:----------:|:--------|:--------------:|:----------:|
| 3.11  | 2022-10-24 | 3.11.4  |   2023-06-06   | 2027-10-24 |
| 3.10  | 2021-10-04 | 3.10.12 |   2023-06-06   | 2026-10-04 |
| 3.9   | 2020-10-05 | 3.9.17  |   2023-06-06   | 2025-10-05 |
| 3.8   | 2019-10-14 | 3.8.17  |   2023-06-06   | 2024-10-14 |
| 3.7   | 2018-06-26 | 3.7.17  |   2023-06-05   | 2023-06-27 |
| 3.6   | 2016-12-22 | 3.6.15  |   2021-09-03   | 2021-12-23 |
| 3.5   | 2015-09-12 | 3.5.10  |   2020-09-05   | 2020-09-13 |
| 3.4   | 2014-03-15 | 3.4.10  |   2019-03-18   | 2019-03-18 |
| 3.3   | 2012-09-29 | 3.3.7   |   2017-09-19   | 2017-09-29 |
| 2.7   | 2010-07-03 | 2.7.18  |   2020-04-19   | 2020-01-01 |
| 2.6   | 2008-10-01 | 2.6.9   |   2013-10-29   | 2013-10-29 |
❯ eol python --md
| cycle |  release   | latest  | latest release |    eol     |
|:------|:----------:|:--------|:--------------:|:----------:|
| 3.11  | 2022-10-24 | 3.11.4  |   2023-06-06   | 2027-10-24 |
| 3.10  | 2021-10-04 | 3.10.12 |   2023-06-06   | 2026-10-04 |
| 3.9   | 2020-10-05 | 3.9.17  |   2023-06-06   | 2025-10-05 |
| 3.8   | 2019-10-14 | 3.8.17  |   2023-06-06   | 2024-10-14 |
| 3.7   | 2018-06-26 | 3.7.17  |   2023-06-05   | 2023-06-27 |
| 3.6   | 2016-12-22 | 3.6.15  |   2021-09-03   | 2021-12-23 |
| 3.5   | 2015-09-12 | 3.5.10  |   2020-09-05   | 2020-09-13 |
| 3.4   | 2014-03-15 | 3.4.10  |   2019-03-18   | 2019-03-18 |
| 3.3   | 2012-09-29 | 3.3.7   |   2017-09-19   | 2017-09-29 |
| 2.7   | 2010-07-03 | 2.7.18  |   2020-04-19   | 2020-01-01 |
| 2.6   | 2008-10-01 | 2.6.9   |   2013-10-29   | 2013-10-29 |
codecov[bot] commented 1 year ago

Codecov Report

Merging #169 (4c962a4) into main (063b996) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #169   +/-   ##
=======================================
  Coverage   98.97%   98.97%           
=======================================
  Files           7        7           
  Lines         389      389           
=======================================
  Hits          385      385           
  Misses          4        4           
Flag Coverage Δ
macos-latest 98.97% <ø> (ø)
ubuntu-latest 98.97% <ø> (ø)
windows-latest 98.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

adriens commented 1 year ago

Yes, fore sur UX is much nicer :pray: