Skip to content

Commit 4ffc872

Browse files
authored
Show spinner when querying (#279)
2 parents acc8d9f + 6d8f883 commit 4ffc872

3 files changed

Lines changed: 17 additions & 12 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ dependencies = [
4343
"python-slugify",
4444
"termcolor>=2.1",
4545
"urllib3>=2",
46+
"yaspin",
4647
]
4748
optional-dependencies.tests = [
4849
"freezegun",

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ pytest-cov==7.0.0
88
python-slugify==8.0.4
99
termcolor==3.2.0
1010
urllib3==2.6.0
11+
yaspin==3.4.0

src/norwegianblue/cli.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import platform
2121

2222
from termcolor import colored
23+
from yaspin import yaspin
2324

2425
try:
2526
import argcomplete
@@ -121,12 +122,13 @@ def main() -> None:
121122
)
122123
for product in args.product:
123124
try:
124-
output = norwegianblue.norwegianblue(
125-
product=product,
126-
format=args.formatter,
127-
color=args.color,
128-
show_title=show_title,
129-
)
125+
with yaspin(color="yellow"):
126+
output = norwegianblue.norwegianblue(
127+
product=product,
128+
format=args.formatter,
129+
color=args.color,
130+
show_title=show_title,
131+
)
130132
except ValueError as e:
131133
suggestion = norwegianblue.suggest_product(product)
132134

@@ -141,12 +143,13 @@ def main() -> None:
141143
if answer not in ("", "y", "Y"):
142144
print()
143145
continue
144-
output = norwegianblue.norwegianblue(
145-
product=suggestion,
146-
format=args.formatter,
147-
color=args.color,
148-
show_title=show_title,
149-
)
146+
with yaspin(color="yellow"):
147+
output = norwegianblue.norwegianblue(
148+
product=suggestion,
149+
format=args.formatter,
150+
color=args.color,
151+
show_title=show_title,
152+
)
150153
print(output)
151154
print()
152155
if args.web:

0 commit comments

Comments
 (0)