decider WIP
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from logging import log
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
@@ -28,25 +29,25 @@ class Refit_Create:
|
||||
self.recursive = args.recursive
|
||||
self.args = args
|
||||
|
||||
def create_input_valid(self, args):
|
||||
"""Checks if the input is argument for its existence. If no input
|
||||
argument with a value is passed, the current directory is used and
|
||||
passed to the input"""
|
||||
# def create_input_valid(self, args):
|
||||
# """Checks if the input is argument for its existence. If no input
|
||||
# argument with a value is passed, the current directory is used and
|
||||
# passed to the input"""
|
||||
|
||||
logger.debug(f"Start create_input_valid() value= {self.input}")
|
||||
logger.debug(f"FUNC: create_input_valid() MSG: arguments: {args}")
|
||||
if self.input is None:
|
||||
input = "."
|
||||
self.input = input
|
||||
logger.info(
|
||||
f"FUNC: create_input_valid MSG: Usingsing current directory as input. value={self.input} "
|
||||
)
|
||||
return self.input
|
||||
else:
|
||||
logger.debug(
|
||||
f"FUNC: create_input_valid() MSG: Exit with valid input. value= {self.input}"
|
||||
)
|
||||
return True
|
||||
# logger.debug(f"Start create_input_valid() value= {self.input}")
|
||||
# logger.debug(f"FUNC: create_input_valid() MSG: arguments: {args}")
|
||||
# if self.input is None:
|
||||
# input = "."
|
||||
# self.input = input
|
||||
# logger.info(
|
||||
# f"FUNC: create_input_valid MSG: Usingsing current directory as input. value={self.input} "
|
||||
# )
|
||||
# return self.input
|
||||
# else:
|
||||
# logger.debug(
|
||||
# f"FUNC: create_input_valid() MSG: Exit with valid input. value= {self.input}"
|
||||
# )
|
||||
# return True
|
||||
|
||||
def create_n_folders(self, n, input, name):
|
||||
"""Creates an set ammount of folders. Using the default directory
|
||||
@@ -134,11 +135,14 @@ class Refit_Create:
|
||||
if self.filemode:
|
||||
logger.debug("DECISION if filemode")
|
||||
self.create_n_files(self.n, self.input, self.name)
|
||||
elif self.n is not None:
|
||||
elif self.n is not None and self.recursive is False:
|
||||
logger.debug(
|
||||
f"DIR-MODE | ARGS: n={self.n} input={self.input} name={self.name}"
|
||||
f"FUNC: {self.rf_create_decider.__name__} DIR-MODE | ARGS: n={self.n} input={self.input} name={self.name}"
|
||||
)
|
||||
self.create_n_folders(self.n, self.input, self.name)
|
||||
elif self.recursive:
|
||||
logger.error("EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE")
|
||||
logger.debug(f"FUNC: {self.rf_create_decider.__name__}")
|
||||
else:
|
||||
logger.debug(f"FUNC: rf_create_decider() MSG: given arguments: {self.args}")
|
||||
print(
|
||||
|
||||
@@ -73,7 +73,8 @@ create_parser.add_argument(
|
||||
create_parser.add_argument(
|
||||
"-r",
|
||||
"--recursive",
|
||||
nargs="*",
|
||||
action="store_true",
|
||||
# nargs="*",
|
||||
help="Sets the recursive mode for folders to true. First argumet\n is for the depth and the second for the width.",
|
||||
)
|
||||
create_parser.set_defaults(command_class=Refit_Create)
|
||||
|
||||
Reference in New Issue
Block a user