-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ replace blessed with rich/textual (#113)
- Loading branch information
Showing
26 changed files
with
420 additions
and
1,544 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,10 @@ Click | |
aiofiles | ||
asyncssh | ||
bcrypt | ||
blessed | ||
gino | ||
redis | ||
rich | ||
textual | ||
toml | ||
uvicorn[standard] | ||
uvloop | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,39 @@ | ||
"""Lock example""" | ||
|
||
# stdlib | ||
from asyncio import sleep | ||
from asyncio import QueueEmpty, sleep | ||
|
||
# api | ||
from xthulu.ssh.context import SSHContext | ||
|
||
|
||
async def main(cx: SSHContext): | ||
cx.echo( | ||
cx.term.normal, | ||
"\r\n\r\n", | ||
cx.term.bright_white_on_yellow_underline(" Shared locks demo "), | ||
"\r\n\r\n", | ||
) | ||
cx.echo("\n\n[bright_white on yellow underline] Shared locks demo [/]\n\n") | ||
|
||
with cx.lock("testing") as l: | ||
if l: | ||
if cx.encoding == "utf-8": | ||
cx.echo("🔒 ") | ||
|
||
cx.echo("Lock acquired; press any key to release\r\n") | ||
await cx.term.inkey() | ||
lock = "🔒 " if cx.encoding == "utf-8" else "" | ||
|
||
with cx.term.status( | ||
f"{lock}Lock acquired; press any key to release " | ||
): | ||
while True: | ||
try: | ||
cx.input.get_nowait() | ||
break | ||
except QueueEmpty: | ||
await sleep(0.1) | ||
|
||
if cx.encoding == "utf-8": | ||
cx.echo("🔥 ") | ||
|
||
cx.echo("Lock released!\r\n") | ||
cx.echo("Lock released!\n") | ||
await sleep(1) | ||
|
||
return | ||
|
||
if cx.encoding == "utf-8": | ||
cx.echo("❌ ") | ||
|
||
cx.echo("Failed to acquire lock\r\n") | ||
cx.echo("Failed to acquire lock\n") | ||
await sleep(2) |
Oops, something went wrong.