FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cecli/cecli/waiting.py at main · cecli-dev/cecli · GitHub
cecli-dev
cecli
Repository navigation
Code
Issues
11
(11)
Pull requests
8
(8)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cecli
/
cecli
/
waiting.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (29 loc) · 952 Bytes
Breadcrumbs
cecli
/
cecli
/
waiting.py
Copy path
File metadata and controls
38 lines (29 loc) · 952 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
"""
A simple wrapper for rich.status to provide a spinner.
"""
class
Spinner
:
"""A wrapper around rich.status.Status for displaying a spinner."""
def
__init__
(
self
,
text
:
str
=
"Waiting..."
):
from
rich
.
console
import
Console
self
.
text
=
text
self
.
console
=
Console
()
self
.
status
=
None
def
step
(
self
,
message
=
None
):
"""Start the spinner or update its text."""
if
self
.
status
is
None
:
self
.
status
=
self
.
console
.
status
(
self
.
text
,
spinner
=
"dots2"
)
self
.
status
.
start
()
elif
message
:
self
.
status
.
update
(
message
)
def
end
(
self
):
"""Stop the spinner."""
if
self
.
status
:
self
.
status
.
stop
()
self
.
status
=
None
# Allow use as a context-manager
def
__enter__
(
self
):
self
.
step
()
return
self
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
self
.
end
()
Back
|
FazBrowse Home
|
New Git URL