add --versionb; closes #933

This commit is contained in:
ed
2025-10-17 22:30:14 +00:00
parent f73742b6a4
commit 51e6099c58
3 changed files with 12 additions and 3 deletions

View File

@@ -1177,6 +1177,7 @@ def add_general(ap, nc, srvname):
ap2.add_argument("--rmagic", action="store_true", help="do expensive analysis to improve accuracy of returned mimetypes; will make file-downloads, rss, and webdav slower (volflag=rmagic)") ap2.add_argument("--rmagic", action="store_true", help="do expensive analysis to improve accuracy of returned mimetypes; will make file-downloads, rss, and webdav slower (volflag=rmagic)")
ap2.add_argument("--license", action="store_true", help="show licenses and exit") ap2.add_argument("--license", action="store_true", help="show licenses and exit")
ap2.add_argument("--version", action="store_true", help="show versions and exit") ap2.add_argument("--version", action="store_true", help="show versions and exit")
ap2.add_argument("--versionb", action="store_true", help="show version and exit")
def add_qr(ap, tty): def add_qr(ap, tty):
@@ -1957,15 +1958,19 @@ def run_argparse(
def main(argv: Optional[list[str]] = None) -> None: def main(argv: Optional[list[str]] = None) -> None:
if argv is None:
argv = sys.argv
if "--versionb" in argv:
print(S_VERSION)
sys.exit(0)
time.strptime("19970815", "%Y%m%d") # python#7980 time.strptime("19970815", "%Y%m%d") # python#7980
if WINDOWS: if WINDOWS:
os.system("rem") # enables colors os.system("rem") # enables colors
init_E(E) init_E(E)
if argv is None:
argv = sys.argv
f = '\033[36mcopyparty v{} "\033[35m{}\033[36m" ({})\n{}\033[0;36m\n sqlite {} | jinja {} | pyftpd {} | tftp {}\n\033[0m' f = '\033[36mcopyparty v{} "\033[35m{}\033[36m" ({})\n{}\033[0;36m\n sqlite {} | jinja {} | pyftpd {} | tftp {}\n\033[0m'
f = f.format( f = f.format(
S_VERSION, S_VERSION,

View File

@@ -439,6 +439,8 @@ def run_s(ld):
def main(): def main():
if "--versionb" in sys.argv:
return print(VER)
sysver = str(sys.version).replace("\n", "\n" + " " * 18) sysver = str(sys.version).replace("\n", "\n" + " " * 18)
pktime = time.strftime("%Y-%m-%d, %H:%M:%S", time.gmtime(STAMP)) pktime = time.strftime("%Y-%m-%d, %H:%M:%S", time.gmtime(STAMP))
msg() msg()

View File

@@ -38,6 +38,8 @@ def run():
def main(): def main():
if "--versionb" in sys.argv:
return print(VER)
pktime = time.strftime("%Y-%m-%d, %H:%M:%S", time.gmtime(STAMP)) pktime = time.strftime("%Y-%m-%d, %H:%M:%S", time.gmtime(STAMP))
msg() msg()
msg("build-time:", pktime, "UTC,", STAMP) msg("build-time:", pktime, "UTC,", STAMP)