Compare commits
3 Commits
691b68cb4c
...
f4f5f9bc6b
| Author | SHA1 | Date | |
|---|---|---|---|
| f4f5f9bc6b | |||
| 3c1d881de7 | |||
| b4e5694b7b |
10
README.md
10
README.md
@@ -6,8 +6,12 @@ Collection of my python scripts and programs. Containing tools to manipulate the
|
||||
## tempbox
|
||||
|
||||
A script which allows the user to execute commands in a temporary
|
||||
directory.
|
||||
directory.
|
||||
|
||||
### Wannado´s
|
||||
After execution, all contents within the folder get removed.
|
||||
|
||||
- switch between temp file and temp dir
|
||||
|
||||
## refit
|
||||
|
||||
A file and folder manipulation tool. The aim is to unify various steps from moving to creating and deleting
|
||||
directories and folder with one tool.
|
||||
@@ -119,14 +119,16 @@ def get_current_path(path) -> str:
|
||||
"""
|
||||
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.debug(
|
||||
f"FUNC: {get_current_path.__name__} MSG: Path now has the value: '{path}'"
|
||||
logger.warning(
|
||||
f"FUNC: {get_current_path.__name__}() MSG: Path now has the value: '{path}'"
|
||||
)
|
||||
return path
|
||||
else:
|
||||
# Here the check for the path to exist takes place
|
||||
|
||||
|
||||
# Checks if the path, entered by the user, exists.
|
||||
if os.path.exists(path) is True:
|
||||
logger.debug(
|
||||
f"FUNC: {get_current_path.__name__} MSG: Path '{path}' exists, continue...."
|
||||
|
||||
@@ -101,23 +101,14 @@ class Refit_Create:
|
||||
n -= 1
|
||||
|
||||
def input_validator(self):
|
||||
logger.debug("FUNC: input_validator()")
|
||||
return True
|
||||
|
||||
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")
|
||||
|
||||
# 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}'"
|
||||
)
|
||||
|
||||
"""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
|
||||
# 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")
|
||||
|
||||
# Exit the program if the -n argument is not passed
|
||||
if self.n is None:
|
||||
logger.error(
|
||||
@@ -125,6 +116,17 @@ 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()
|
||||
if self.input_validator():
|
||||
logger.debug("yippie")
|
||||
|
||||
|
||||
# Exits the program if recursive and filemode flags are set at the same time
|
||||
if self.filemode:
|
||||
@@ -135,8 +137,6 @@ class Refit_Create:
|
||||
logger.error("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:
|
||||
self.create_n_folders(self.n, self.input, self.name)
|
||||
|
||||
Reference in New Issue
Block a user