move shared variables
This commit is contained in:
parent
643673317b
commit
8eb54555f5
32
imgsort/globals.py
Normal file
32
imgsort/globals.py
Normal file
@ -0,0 +1,32 @@
|
||||
version = "1.2"
|
||||
|
||||
settings_map = {
|
||||
"q": "quit",
|
||||
"s": "skip",
|
||||
"u": "undo",
|
||||
"o": "open"
|
||||
}
|
||||
|
||||
from os import makedirs
|
||||
|
||||
def error(*args, exitcode=1, **kwargs):
|
||||
print("\033[31mError: \033[0m", *args, **kwargs)
|
||||
exit(exitcode)
|
||||
|
||||
def user_error(*args, exitcode=1, **kwargs):
|
||||
print("\033[31mError: \033[0m", *args, **kwargs)
|
||||
exit(exitcode)
|
||||
|
||||
def warning(*args, **kwargs):
|
||||
print("\033[33mWarning: \033[0m", *args, **kwargs)
|
||||
|
||||
def info(*args, **kwargs):
|
||||
print("\033[34mInfo: \033[0m", *args, **kwargs)
|
||||
|
||||
def create_dir(d):
|
||||
try:
|
||||
makedirs(d)
|
||||
except PermissionError as e:
|
||||
error(f"Could not create '{d}': PermissionError: {e}")
|
||||
except Exception as e:
|
||||
error(f"Could not create '{d}': {e}")
|
Loading…
Reference in New Issue
Block a user