split decider and input_validator
This commit is contained in:
@@ -101,23 +101,14 @@ class Refit_Create:
|
|||||||
n -= 1
|
n -= 1
|
||||||
|
|
||||||
def input_validator(self):
|
def input_validator(self):
|
||||||
logger.debug("FUNC: input_validator()")
|
"""Function, which checks if the user input is valid"""
|
||||||
return True
|
# !!!TODO: make the function return true for the check and only continue the decider if the validation check
|
||||||
|
# passes
|
||||||
def rf_create_decider(self):
|
# Check working directory
|
||||||
"""Coordination of the 'create' sub command"""
|
if self.input is None:
|
||||||
logger.debug("FUNC: rf_create_decider() MSG: Entered decider function")
|
self.input = librefit.get_current_path(self.input)
|
||||||
# !!!ToDo: implement input_validator()
|
logger.info("FUNC: input_validator() MSG: No directory passed to the command, continue with current directory")
|
||||||
if self.input_validator():
|
|
||||||
logger.debug("yippie")
|
|
||||||
|
|
||||||
# if no input is provided, current directory is set to input
|
|
||||||
logger.debug(f"DEBUG HERE!: type of path is: {type(self.input)}")
|
|
||||||
self.input = librefit.get_current_path(self.input)
|
|
||||||
logger.debug(
|
|
||||||
f"FUNC: rf_create_decider() MSG: successfully retrievd input value: '{self.input}'"
|
|
||||||
)
|
|
||||||
|
|
||||||
# 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(
|
||||||
@@ -125,6 +116,17 @@ 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):
|
||||||
|
"""Coordination of the 'create' sub command"""
|
||||||
|
logger.debug("FUNC: rf_create_decider() MSG: Entered decider function")
|
||||||
|
|
||||||
|
|
||||||
|
# !!!ToDo: implement input_validator()
|
||||||
|
if self.input_validator():
|
||||||
|
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:
|
||||||
@@ -135,8 +137,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:
|
|
||||||
print("help")
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user