update @ Wed 17 Aug 01:51:03 EEST 2022

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-08-17 01:51:03 +03:00
parent 27c4d86aa6
commit 8454f452ce
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: A50D5B4B599AF8A2

View file

@ -5,10 +5,8 @@
import json import json
import os import os
import random import random
import readline
import string import string
import sys import sys
from atexit import register as fn_register
from base64 import b64decode, b64encode from base64 import b64decode, b64encode
from datetime import datetime from datetime import datetime
from glob import iglob from glob import iglob
@ -25,6 +23,12 @@ from markdown import markdown # type: ignore
from plumbum.commands.processes import ProcessExecutionError # type: ignore from plumbum.commands.processes import ProcessExecutionError # type: ignore
from pyfzf import FzfPrompt # type: ignore from pyfzf import FzfPrompt # type: ignore
NOT_CI_BUILD: bool = not os.getenv("CI")
if NOT_CI_BUILD:
import readline
from atexit import register as fn_register
EXIT_OK: int = 0 EXIT_OK: int = 0
EXIT_ERR: int = 1 EXIT_ERR: int = 1
@ -695,6 +699,7 @@ def usage(code: int = EXIT_ERR, config: Dict = None) -> int:
def main() -> int: def main() -> int:
"""Entry/main function""" """Entry/main function"""
if NOT_CI_BUILD:
if not os.path.isfile(HISTORY_FILE): if not os.path.isfile(HISTORY_FILE):
open(HISTORY_FILE, "w").close() open(HISTORY_FILE, "w").close()
@ -710,6 +715,7 @@ def main() -> int:
if not os.path.isfile(DEFAULT_CONFIG_FILE): if not os.path.isfile(DEFAULT_CONFIG_FILE):
new_config() new_config()
log(f"PLease configure {DEFAULT_CONFIG_FILE!r}")
return EXIT_ERR return EXIT_ERR
if len(sys.argv) != 2: if len(sys.argv) != 2:
@ -729,9 +735,7 @@ def main() -> int:
"TIME", "TIME",
) )
not_ci_build = not os.getenv("CI") if config["blogs"] and NOT_CI_BUILD:
if config["blogs"] and not_ci_build:
log("Sorting blogs by creation time...", "CLEANUP") log("Sorting blogs by creation time...", "CLEANUP")
sort_timer = code_timer() sort_timer = code_timer()
@ -745,13 +749,12 @@ def main() -> int:
log(f"Sorted in {code_timer() - sort_timer} seconds", "TIME") log(f"Sorted in {code_timer() - sort_timer} seconds", "TIME")
if not_ci_build:
log("Redumping config", "CONFIG") log("Redumping config", "CONFIG")
dump_timer = code_timer() dump_timer = code_timer()
with open(DEFAULT_CONFIG_FILE, "w") as dcfg: with open(DEFAULT_CONFIG_FILE, "w") as dcfg:
json.dump(config, dcfg, indent=4) json.dump(config, dcfg, indent=(4 if NOT_CI_BUILD else 0))
log(f"Dumped config in {code_timer() - dump_timer} seconds", "TIME") log(f"Dumped config in {code_timer() - dump_timer} seconds", "TIME")