teplater
This commit is contained in:
@@ -10,7 +10,7 @@ import sys
|
|||||||
import termios
|
import termios
|
||||||
import tty
|
import tty
|
||||||
|
|
||||||
__version__ = "20250311.a"
|
__version__ = "20250317.a"
|
||||||
|
|
||||||
|
|
||||||
class bc:
|
class bc:
|
||||||
@@ -37,6 +37,10 @@ class bc:
|
|||||||
setattr(self, x, "")
|
setattr(self, x, "")
|
||||||
setattr(self, "bold", "")
|
setattr(self, "bold", "")
|
||||||
|
|
||||||
|
def format(self, s):
|
||||||
|
format_dict = {x: getattr(self, x) for x in "rgbcmyzkRGBCMY"}
|
||||||
|
return s.format(**format_dict)
|
||||||
|
|
||||||
|
|
||||||
class QAsk:
|
class QAsk:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -54,7 +58,13 @@ class QAsk:
|
|||||||
epilog="Dialog printed to stderr, user input echoed to stdout, i.e. input=$( qaskpass )",
|
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(
|
parser.add_argument(
|
||||||
"-w", action="store", type=int, default=5, help="Width of display area. 0 to disable display."
|
"-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="")
|
print(self.c.noblink, file=sys.stderr, end="")
|
||||||
self.dot = "•"
|
self.dot = "•"
|
||||||
if self.opts.title:
|
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:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user