Compare commits
2 Commits
5270fab084
...
b615f52313
| Author | SHA1 | Date | |
|---|---|---|---|
| b615f52313 | |||
| 799e0239a1 |
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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}"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[VERSION]
|
||||
major = 0
|
||||
minor = 2
|
||||
patch = 4
|
||||
minor = 3
|
||||
patch = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user