Skip to content

Commit

Permalink
Add --show-title flag
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotwutingfeng committed Feb 3, 2024
1 parent fff64dd commit 2a9caa6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ options:
-c {yes,no,auto}, --color {yes,no,auto}
colour the output (default: auto)
--clear-cache clear cache before running
--show-title {yes,no,auto}
show or hide product title, 'auto' to show title only for multiple products (default: auto)
-v, --verbose print extra messages to stderr
-V, --version show program's version number and exit
-w, --web open product page in web browser
Expand Down
1 change: 1 addition & 0 deletions src/norwegianblue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Python interface to endoflife.date API
https://endoflife.date/docs/api/
"""

from __future__ import annotations

import datetime as dt
Expand Down
1 change: 1 addition & 0 deletions src/norwegianblue/_cache.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Cache functions
"""

from __future__ import annotations

import datetime as dt
Expand Down
9 changes: 8 additions & 1 deletion src/norwegianblue/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ def main() -> None:
parser.add_argument(
"--clear-cache", action="store_true", help="clear cache before running"
)
parser.add_argument(
"--show-title",
default="auto",
choices=("yes", "no", "auto"),
help="show or hide product title, 'auto' to show title only for multiple products (default: auto)",
)
parser.add_argument(
"-v",
"--verbose",
Expand Down Expand Up @@ -133,7 +139,8 @@ def main() -> None:
product=product,
format=args.formatter,
color=args.color,
show_title=multiple_products,
show_title=(args.show_title == "yes")
or (multiple_products and args.show_title != "no"),
)
except ValueError as e:
suggestion = norwegianblue.suggest_product(product)
Expand Down
1 change: 1 addition & 0 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Unit tests for norwegianblue cache
"""

from __future__ import annotations

import tempfile
Expand Down
1 change: 1 addition & 0 deletions tests/test_norwegianblue.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Unit tests for norwegianblue
"""

from __future__ import annotations

import json
Expand Down

0 comments on commit 2a9caa6

Please sign in to comment.