Compare commits

..

2 Commits

Author SHA1 Message Date
b615f52313 added file creation 2025-09-29 21:38:42 +02:00
799e0239a1 update README.md 2025-09-29 21:37:50 +02:00
4 changed files with 44 additions and 10 deletions

View File

@@ -15,6 +15,7 @@
## Changelog
<2025-09-29> V0.3.0 - Added file creation in the pattern like directories
<2025-09-29> V0.2.4 - Improved logging and log readability
<2025-09-28> V0.2.3 - Added logging for version file and --filemode path to the decider
<2025-09-28> V0.2.0 - Added librefit for standard functions

View File

@@ -3,14 +3,14 @@ from .refit_logger import logger
def get_standard_name_number(current_number, number_str_length):
"""returns a number string filled to the length of the input number"""
logger.debug(
f"FUNC: get_standard_name_number() index={current_number} string_length={number_str_length}"
)
# logger.debug(
# f"FUNC: get_standard_name_number() index={current_number} string_length={number_str_length}"
# )
current_number = str(current_number)
standard_name_number = str.zfill(current_number, number_str_length)
logger.debug(
f"FUNC: get_standard_name_number() return value= '{standard_name_number}'"
)
# logger.debug(
# f"FUNC: get_standard_name_number() return value= '{standard_name_number}'"
# )
return standard_name_number

View File

@@ -1,5 +1,6 @@
import argparse
import os
from pathlib import Path
from .refit_logger import logger
from . import librefit
@@ -65,10 +66,10 @@ class Refit_Create:
while n > 0:
# iterating down for the files number.
i = str(n - 1)
folder_number = str(n - 1)
# Passing the number and the length of the string to get the string back.
number_string = librefit.get_standard_name_number(i, length_n)
number_string = librefit.get_standard_name_number(folder_number, length_n)
# Creating path for the folder
temp_name = f"{folder_name}_{number_string}"
@@ -78,6 +79,37 @@ class Refit_Create:
os.mkdir(folder_creation_path)
n -= 1
def create_n_files(self, n, input, name):
"""Creates an set ammount of files, using the default file name
if none is provided."""
logger.debug(
f"FUNC: create_n_files() MSG: Entered function VALUES: n={self.n} name={self.name} input={self.input}"
)
# Get name of the file
file_name = librefit.get_standard_file_name(name)
length_n = len(str(n))
logger.debug(
f"FUNC: create_n_files() MSG: file name='{file_name}' length_n={length_n}"
)
while n > 0:
# Get number of the file(s) to create
file_number = str(n - 1)
number_string = librefit.get_standard_name_number(file_number, length_n)
temp_name = f"{file_name}_{number_string}"
file_path = Path(os.path.join(input, temp_name))
file_path.touch(exist_ok=True)
logger.debug(
f"FUNC: create_n_files MSG: created file at {os.path.join(input, temp_name)}"
)
n -= 1
def rf_create_decider(self):
"""Coordination of the 'create' sub command"""
logger.debug("FUNC: rf_create_decider() MSG: Entered decider function")
@@ -86,6 +118,7 @@ class Refit_Create:
if self.filemode:
logger.debug("DECISION if filemode")
self.create_n_files(self.n, self.input, self.name)
else:
logger.debug(
f"DIR-MODE | ARGS: n={self.n} input={self.input} name={self.name}"

View File

@@ -1,5 +1,5 @@
[VERSION]
major = 0
minor = 2
patch = 4
minor = 3
patch = 0