diff --git a/refit/src/modules/librefit.py b/refit/src/modules/librefit.py index f42ce72..31dcf29 100644 --- a/refit/src/modules/librefit.py +++ b/refit/src/modules/librefit.py @@ -3,6 +3,9 @@ import sys from .refit_logger import logger +# TODO: Make a standard function for reading config files, so it is +# reusable + def get_standard_name_number(current_number: str, number_str_length: int) -> str: """Returns a number string filled to the length of the input number @@ -117,9 +120,16 @@ def get_current_path(path) -> str: Returns: str: _Returns the path of the current directory after check for existence_ """ + + # TODO: write test for the current path function, test for: + # - None + # - for existing path + # - for non existing path + + # NOTE: research how to check for paths in test functions... + logger.debug(f"FUNC: get_current_path() MSG: entered function with path = '{path}'") if path is None: - # Set the current directory if none is passed with the command. path = "." logger.warning( @@ -127,7 +137,6 @@ def get_current_path(path) -> str: ) return path else: - # Checks if the path, entered by the user, exists. if os.path.exists(path) is True: logger.debug( diff --git a/refit/src/modules/refit_create.py b/refit/src/modules/refit_create.py index 1660d28..9d51cf1 100644 --- a/refit/src/modules/refit_create.py +++ b/refit/src/modules/refit_create.py @@ -1,4 +1,3 @@ -from logging import log import os from pathlib import Path import sys @@ -102,13 +101,17 @@ class Refit_Create: def input_validator(self): """Function, which checks if the user input is valid""" - # !!!TODO: make the function return true for the check and only continue the decider if the validation check - # passes + + # NOTE: find a way on how to return 'True' when the user input + # is valid + # Check working directory if self.input is None: self.input = librefit.get_current_path(self.input) - logger.info("FUNC: input_validator() MSG: No directory passed to the command, continue with current directory") - + logger.info( + "FUNC: input_validator() MSG: No directory passed to the command, continue with current directory" + ) + # Exit the program if the -n argument is not passed if self.n is None: logger.error( @@ -116,18 +119,16 @@ class Refit_Create: ) print("Use the '-n' flag for the create command.") sys.exit(1) - def rf_create_decider(self): """Coordination of the 'create' sub command""" logger.debug("FUNC: rf_create_decider() MSG: Entered decider function") - - - # !!!ToDo: implement input_validator() + + # WARNING: implement the input validator and only continue with + # the decider if the validator returns true if self.input_validator(): logger.debug("yippie") - # Exits the program if recursive and filemode flags are set at the same time if self.filemode: logger.debug("DECISION filemode set, creating files instead of folders") @@ -137,7 +138,6 @@ class Refit_Create: logger.error("Recursive and filemode don´t work together.") print("Recursive and filemode don´t work together.") - if self.recursive is None: self.create_n_folders(self.n, self.input, self.name) else: diff --git a/refit/src/refit.py b/refit/src/refit.py index 127b8df..76c664c 100644 --- a/refit/src/refit.py +++ b/refit/src/refit.py @@ -10,6 +10,11 @@ from modules.refit_create import Refit_Create CONFIG_FILE = "version.cfg" +# TODO: comment the actions done in read_version_config() + + +# TODO: see the TODO in librefit: move the config file section into the +# libary def read_version_config(): logger.debug(f"Start read_version_config() with config file: {CONFIG_FILE}") config = configparser.ConfigParser() @@ -40,6 +45,10 @@ def read_version_config(): REFIT_VERSION = f"Refit Beta {read_version_config()}" # ---------------------------ARGPARSE START--------------------------- + +# TODO: Rework the structure of the argument parsing + + # Main Parser parser = argparse.ArgumentParser( prog="Refit",