added TODO comments
This commit is contained in:
@@ -3,6 +3,9 @@ import sys
|
|||||||
|
|
||||||
from .refit_logger import logger
|
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:
|
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
|
"""Returns a number string filled to the length of the input number
|
||||||
@@ -117,9 +120,16 @@ def get_current_path(path) -> str:
|
|||||||
Returns:
|
Returns:
|
||||||
str: _Returns the path of the current directory after check for existence_
|
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}'")
|
logger.debug(f"FUNC: get_current_path() MSG: entered function with path = '{path}'")
|
||||||
if path is None:
|
if path is None:
|
||||||
|
|
||||||
# Set the current directory if none is passed with the command.
|
# Set the current directory if none is passed with the command.
|
||||||
path = "."
|
path = "."
|
||||||
logger.warning(
|
logger.warning(
|
||||||
@@ -127,7 +137,6 @@ def get_current_path(path) -> str:
|
|||||||
)
|
)
|
||||||
return path
|
return path
|
||||||
else:
|
else:
|
||||||
|
|
||||||
# Checks if the path, entered by the user, exists.
|
# Checks if the path, entered by the user, exists.
|
||||||
if os.path.exists(path) is True:
|
if os.path.exists(path) is True:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from logging import log
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
@@ -102,13 +101,17 @@ class Refit_Create:
|
|||||||
|
|
||||||
def input_validator(self):
|
def input_validator(self):
|
||||||
"""Function, which checks if the user input is valid"""
|
"""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
|
# Check working directory
|
||||||
if self.input is None:
|
if self.input is None:
|
||||||
self.input = librefit.get_current_path(self.input)
|
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
|
# Exit the program if the -n argument is not passed
|
||||||
if self.n is None:
|
if self.n is None:
|
||||||
logger.error(
|
logger.error(
|
||||||
@@ -116,18 +119,16 @@ class Refit_Create:
|
|||||||
)
|
)
|
||||||
print("Use the '-n' flag for the create command.")
|
print("Use the '-n' flag for the create command.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def rf_create_decider(self):
|
def rf_create_decider(self):
|
||||||
"""Coordination of the 'create' sub command"""
|
"""Coordination of the 'create' sub command"""
|
||||||
logger.debug("FUNC: rf_create_decider() MSG: Entered decider function")
|
logger.debug("FUNC: rf_create_decider() MSG: Entered decider function")
|
||||||
|
|
||||||
|
# WARNING: implement the input validator and only continue with
|
||||||
# !!!ToDo: implement input_validator()
|
# the decider if the validator returns true
|
||||||
if self.input_validator():
|
if self.input_validator():
|
||||||
logger.debug("yippie")
|
logger.debug("yippie")
|
||||||
|
|
||||||
|
|
||||||
# Exits the program if recursive and filemode flags are set at the same time
|
# Exits the program if recursive and filemode flags are set at the same time
|
||||||
if self.filemode:
|
if self.filemode:
|
||||||
logger.debug("DECISION filemode set, creating files instead of folders")
|
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.")
|
logger.error("Recursive and filemode don´t work together.")
|
||||||
print("Recursive and filemode don´t work together.")
|
print("Recursive and filemode don´t work together.")
|
||||||
|
|
||||||
|
|
||||||
if self.recursive is None:
|
if self.recursive is None:
|
||||||
self.create_n_folders(self.n, self.input, self.name)
|
self.create_n_folders(self.n, self.input, self.name)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ from modules.refit_create import Refit_Create
|
|||||||
CONFIG_FILE = "version.cfg"
|
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():
|
def read_version_config():
|
||||||
logger.debug(f"Start read_version_config() with config file: {CONFIG_FILE}")
|
logger.debug(f"Start read_version_config() with config file: {CONFIG_FILE}")
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
@@ -40,6 +45,10 @@ def read_version_config():
|
|||||||
REFIT_VERSION = f"Refit Beta {read_version_config()}"
|
REFIT_VERSION = f"Refit Beta {read_version_config()}"
|
||||||
|
|
||||||
# ---------------------------ARGPARSE START---------------------------
|
# ---------------------------ARGPARSE START---------------------------
|
||||||
|
|
||||||
|
# TODO: Rework the structure of the argument parsing
|
||||||
|
|
||||||
|
|
||||||
# Main Parser
|
# Main Parser
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog="Refit",
|
prog="Refit",
|
||||||
|
|||||||
Reference in New Issue
Block a user