merge fixes

This commit is contained in:
matthias@arch 2023-12-01 21:10:02 +01:00
parent 56f5423766
commit 07859d6682

View File

@ -3,9 +3,8 @@
import curses as c import curses as c
import ueberzug.lib.v0 as uz import ueberzug.lib.v0 as uz
<<<<<<< HEAD import os
from os import path, getcwd, listdir, makedirs, rename
from os import path, getcwd, listdir, mkdir, makedirs, rename
import subprocess import subprocess
if __name__ == "__main__": # make relative imports work as described here: https://peps.python.org/pep-0366/#proposed-change if __name__ == "__main__": # make relative imports work as described here: https://peps.python.org/pep-0366/#proposed-change
@ -15,7 +14,7 @@ if __name__ == "__main__": # make relative imports work as described here: http
filepath = path.realpath(path.abspath(__file__)) filepath = path.realpath(path.abspath(__file__))
sys.path.insert(0, path.dirname(path.dirname(filepath))) sys.path.insert(0, path.dirname(path.dirname(filepath)))
from .configs import read_config, write_config, select_config, create_config from .configs import read_config, select_config
import argparse import argparse
@ -243,21 +242,16 @@ class Sorter:
return new_path return new_path
def quit(self, message = ""): def quit(self, message = ""):
<<<<<<< HEAD
print(message) print(message)
print(f"Quitting imgsort {version}") print(f"Quitting imgsort {version}")
exit(0) exit(0)
def __del__(self): def __del__(self):
=======
>>>>>>> 1fd5e82 (use argparse and allow sort into other dir)
self.window.clear() self.window.clear()
self.window.refresh() self.window.refresh()
c.endwin() c.endwin()
def main(): def main():
# set working directory # set working directory
print(""" print("""
@ -270,7 +264,7 @@ Image Sorter
if 'IMGSOSRT_CONFIG_DIR' in os.environ: config_dir = os.environ['IMGSORT_CONFIG_DIR'] if 'IMGSOSRT_CONFIG_DIR' in os.environ: config_dir = os.environ['IMGSORT_CONFIG_DIR']
parser = argparse.ArgumentParser("imgsort") parser = argparse.ArgumentParser("imgsort")
parser.add_argument("-c", "--config", action="store", help="name of the config file in ~/.config/imgsort") parser.add_argument("-c", "--config", action="store", help="name of the config file in ($IMGSORT_CONFIG_DIR > $XDG_CONFIG_HOME/imgsort > ~/.config/imgsort)")
parser.add_argument("-i", "--sort-dir", action="store", help="the directory where the folders from the config will be created") parser.add_argument("-i", "--sort-dir", action="store", help="the directory where the folders from the config will be created")
args = parser.parse_args() args = parser.parse_args()
@ -291,13 +285,8 @@ Image Sorter
parser.error(f"invalid configuration path/name:'{config_path}'/'{args.config}'") parser.error(f"invalid configuration path/name:'{config_path}'/'{args.config}'")
else: else:
args.config = select_config() args.config = select_config()
print(config_path)
config = read_config(args.config, root_directory=args.sort_dir)
if config_path is not None:
config = read_config(config_path)
else:
config = create_config()
config = read_config(args.config, root_directory=args.sort_dir)
if not config: if not config:
print("Error reading the config:") print("Error reading the config:")
print(" Config Name:", args.config) print(" Config Name:", args.config)