decider WIP
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
- ~~make input default the current directory and the second argument after `refit create`~~
|
- ~~make input default the current directory and the second argument after `refit create`~~
|
||||||
- ~~maybe get rid of valid input ??~~
|
- ~~maybe get rid of valid input ??~~
|
||||||
- rework rf_create_decider() so it does not execute if no inputs are given -> valid input check back for no arguments passed?
|
- rework rf_create_decider() so it does not execute if no inputs are given -> valid input check back for no arguments passed?
|
||||||
|
- check done in rf_create_decider()
|
||||||
- get rid of input argument, default to current directory and and make it positional
|
- get rid of input argument, default to current directory and and make it positional
|
||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from logging import log
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
@@ -28,25 +29,25 @@ class Refit_Create:
|
|||||||
self.recursive = args.recursive
|
self.recursive = args.recursive
|
||||||
self.args = args
|
self.args = args
|
||||||
|
|
||||||
def create_input_valid(self, args):
|
# def create_input_valid(self, args):
|
||||||
"""Checks if the input is argument for its existence. If no input
|
# """Checks if the input is argument for its existence. If no input
|
||||||
argument with a value is passed, the current directory is used and
|
# argument with a value is passed, the current directory is used and
|
||||||
passed to the input"""
|
# passed to the input"""
|
||||||
|
|
||||||
logger.debug(f"Start create_input_valid() value= {self.input}")
|
# logger.debug(f"Start create_input_valid() value= {self.input}")
|
||||||
logger.debug(f"FUNC: create_input_valid() MSG: arguments: {args}")
|
# logger.debug(f"FUNC: create_input_valid() MSG: arguments: {args}")
|
||||||
if self.input is None:
|
# if self.input is None:
|
||||||
input = "."
|
# input = "."
|
||||||
self.input = input
|
# self.input = input
|
||||||
logger.info(
|
# logger.info(
|
||||||
f"FUNC: create_input_valid MSG: Usingsing current directory as input. value={self.input} "
|
# f"FUNC: create_input_valid MSG: Usingsing current directory as input. value={self.input} "
|
||||||
)
|
# )
|
||||||
return self.input
|
# return self.input
|
||||||
else:
|
# else:
|
||||||
logger.debug(
|
# logger.debug(
|
||||||
f"FUNC: create_input_valid() MSG: Exit with valid input. value= {self.input}"
|
# f"FUNC: create_input_valid() MSG: Exit with valid input. value= {self.input}"
|
||||||
)
|
# )
|
||||||
return True
|
# return True
|
||||||
|
|
||||||
def create_n_folders(self, n, input, name):
|
def create_n_folders(self, n, input, name):
|
||||||
"""Creates an set ammount of folders. Using the default directory
|
"""Creates an set ammount of folders. Using the default directory
|
||||||
@@ -134,11 +135,14 @@ class Refit_Create:
|
|||||||
if self.filemode:
|
if self.filemode:
|
||||||
logger.debug("DECISION if filemode")
|
logger.debug("DECISION if filemode")
|
||||||
self.create_n_files(self.n, self.input, self.name)
|
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(
|
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)
|
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:
|
else:
|
||||||
logger.debug(f"FUNC: rf_create_decider() MSG: given arguments: {self.args}")
|
logger.debug(f"FUNC: rf_create_decider() MSG: given arguments: {self.args}")
|
||||||
print(
|
print(
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ create_parser.add_argument(
|
|||||||
create_parser.add_argument(
|
create_parser.add_argument(
|
||||||
"-r",
|
"-r",
|
||||||
"--recursive",
|
"--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.",
|
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)
|
create_parser.set_defaults(command_class=Refit_Create)
|
||||||
|
|||||||
Reference in New Issue
Block a user