mirror of
https://github.com/9001/copyparty.git
synced 2025-09-28 12:42:26 -06:00
qr-code can optionally ignore -q;
new options --qr-stdout and --qr-stderr will always print the qr-code into the console, even if copyparty is running in quiet mode (-q) closes https://codeberg.org/9001/copyparty/issues/1
This commit is contained in:
parent
ecd18adc3c
commit
d7887f3d55
|
@ -1177,6 +1177,8 @@ def add_qr(ap, tty):
|
|||
ap2.add_argument("--qr-every", metavar="SEC", type=float, default=0, help="print the qr-code every \033[33mSEC\033[0m (try this with/without --qr-pin in case of issues)")
|
||||
ap2.add_argument("--qr-winch", metavar="SEC", type=float, default=0, help="when --qr-pin is enabled, check for terminal size change every \033[33mSEC\033[0m")
|
||||
ap2.add_argument("--qr-file", metavar="TXT", type=u, action="append", help="\033[34mREPEATABLE:\033[0m write qr-code to file.\n └─To create txt or svg, \033[33mTXT\033[0m is Filepath:Zoom:Pad, for example [\033[32mqr.txt:1:2\033[0m]\n └─To create png or gif, \033[33mTXT\033[0m is Filepath:Zoom:Pad:Foreground:Background, for example [\033[32mqr.png:8:2:333333:ffcc55\033[0m], or [\033[32mqr.png:8:2::ffcc55\033[0m] for transparent")
|
||||
ap2.add_argument("--qr-stdout", action="store_true", help="always display the QR-code on STDOUT in the terminal, even if \033[33m-q\033[0m")
|
||||
ap2.add_argument("--qr-stderr", action="store_true", help="always display the QR-code on STDERR in the terminal, even if \033[33m-q\033[0m")
|
||||
|
||||
|
||||
def add_fs(ap):
|
||||
|
|
|
@ -852,6 +852,10 @@ class SvcHub(object):
|
|||
if w8:
|
||||
time.sleep(w8)
|
||||
self.log("qr-code", qr)
|
||||
if self.args.qr_stdout:
|
||||
self.pr(self.tcpsrv.qr)
|
||||
if self.args.qr_stderr:
|
||||
self.pr(self.tcpsrv.qr, file=sys.stderr)
|
||||
w8 = self.args.qr_every
|
||||
msg = "%s\033[%dA" % (qr, len(qr.split("\n")))
|
||||
while w8:
|
||||
|
@ -885,8 +889,13 @@ class SvcHub(object):
|
|||
self.sticky_qr()
|
||||
if self.args.qr_wait or self.args.qr_every or self.args.qr_winch:
|
||||
Daemon(self._qr_thr, "qr")
|
||||
elif not self.args.qr_pin:
|
||||
self.log("qr-code", self.tcpsrv.qr)
|
||||
else:
|
||||
if not self.args.qr_pin:
|
||||
self.log("qr-code", self.tcpsrv.qr)
|
||||
if self.args.qr_stdout:
|
||||
self.pr(self.tcpsrv.qr)
|
||||
if self.args.qr_stderr:
|
||||
self.pr(self.tcpsrv.qr, file=sys.stderr)
|
||||
else:
|
||||
self.log("root", "workers OK\n")
|
||||
|
||||
|
|
Loading…
Reference in a new issue