This commit is contained in:
q
2025-03-17 12:23:59 +02:00
parent f4ee809fc4
commit c90676c1d0

View File

@@ -10,7 +10,7 @@ import sys
import termios
import tty
__version__ = "20250311.a"
__version__ = "20250317.a"
class bc:
@@ -37,6 +37,10 @@ class bc:
setattr(self, x, "")
setattr(self, "bold", "")
def format(self, s):
format_dict = {x: getattr(self, x) for x in "rgbcmyzkRGBCMY"}
return s.format(**format_dict)
class QAsk:
def __init__(self):
@@ -54,7 +58,13 @@ class QAsk:
epilog="Dialog printed to stderr, user input echoed to stdout, i.e. input=$( qaskpass )",
)
parser.add_argument("--title", "-t", action="store", default=None, help="Title for dialog")
parser.add_argument(
"--title",
"-t",
action="store",
default=None,
help="Title for dialog. Use {G} to change color to bright green. Valid codes: rgbcmyzkRGBCMY",
)
parser.add_argument(
"-w", action="store", type=int, default=5, help="Width of display area. 0 to disable display."
)
@@ -148,7 +158,8 @@ class QAsk:
print(self.c.noblink, file=sys.stderr, end="")
self.dot = "•"
if self.opts.title:
print(f"{self.c.Y}{self.opts.title}{self.c.z}", file=sys.stderr)
title = self.c.format(self.opts.title)
print(f"{self.c.Y}{title}{self.c.z}", file=sys.stderr)
while True:
try: