added filemode
This commit is contained in:
@@ -15,5 +15,6 @@
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
<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
|
<2025-09-28> V0.2.0 - Added librefit for standard functions
|
||||||
<2025-09-28> V0.1.0 - Added the creation of multiple numbered directories in a given directory with the pattern default directory_n
|
<2025-09-28> V0.1.0 - Added the creation of multiple numbered directories in a given directory with the pattern default directory_n
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class Refit_Create:
|
|||||||
self.name = args.name
|
self.name = args.name
|
||||||
self.input = args.input
|
self.input = args.input
|
||||||
self.n = args.n
|
self.n = args.n
|
||||||
|
self.filemode = args.filemode
|
||||||
|
|
||||||
def create_input_valid(self):
|
def create_input_valid(self):
|
||||||
"""Checks if the input is valid and returns either True or
|
"""Checks if the input is valid and returns either True or
|
||||||
@@ -72,7 +73,10 @@ class Refit_Create:
|
|||||||
if self.create_input_valid():
|
if self.create_input_valid():
|
||||||
logger.debug("valid input -> continue")
|
logger.debug("valid input -> continue")
|
||||||
|
|
||||||
self.create_n_folders(self.n, self.input, self.name)
|
if self.filemode:
|
||||||
|
logger.debug("filemode active")
|
||||||
|
else:
|
||||||
|
self.create_n_folders(self.n, self.input, self.name)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"End of run---------------------------------------------------------"
|
"End of run---------------------------------------------------------"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,15 +1,42 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
import configparser
|
||||||
|
|
||||||
from modules.refit_logger import logger
|
from modules.refit_logger import logger
|
||||||
from modules.refit_create import Refit_Create
|
from modules.refit_create import Refit_Create
|
||||||
|
|
||||||
from version import GET_VERSION_NUMBER
|
|
||||||
|
|
||||||
current_version = GET_VERSION_NUMBER()
|
CONFIG_FILE = "version.cfg"
|
||||||
|
|
||||||
# Setting Global Variables
|
|
||||||
REFIT_VERSION = f"Refit Beta {current_version}"
|
def read_version_config():
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
logger.debug("reading config file")
|
||||||
|
config.read(CONFIG_FILE)
|
||||||
|
logger.debug("config file read")
|
||||||
|
|
||||||
|
if not os.path.exists(CONFIG_FILE):
|
||||||
|
logger.error("Could not find path")
|
||||||
|
return ""
|
||||||
|
|
||||||
|
if "VERSION" not in config:
|
||||||
|
logger.error("Could not find VERSION in config file")
|
||||||
|
return ""
|
||||||
|
|
||||||
|
try:
|
||||||
|
v = config["VERSION"]
|
||||||
|
major = v.get("major", "0")
|
||||||
|
minor = v.get("minor", "0")
|
||||||
|
patch = v.get("patch", "0")
|
||||||
|
logger.debug(f"output: {major}.{minor}.{patch}")
|
||||||
|
return f"{major}.{minor}.{patch}"
|
||||||
|
except Exception:
|
||||||
|
logger.warning("Couldnt read version")
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
REFIT_VERSION = f"Refit Beta {read_version_config()}"
|
||||||
|
|
||||||
# ---------------------------ARGPARSE START---------------------------
|
# ---------------------------ARGPARSE START---------------------------
|
||||||
# Main Parser
|
# Main Parser
|
||||||
@@ -39,6 +66,9 @@ create_parser.add_argument(
|
|||||||
nargs="*",
|
nargs="*",
|
||||||
help="the name of the folder you want to create\n Default: directory",
|
help="the name of the folder you want to create\n Default: directory",
|
||||||
)
|
)
|
||||||
|
create_parser.add_argument(
|
||||||
|
"--filemode", action="store_true", help="creates files instead of directories"
|
||||||
|
)
|
||||||
create_parser.set_defaults(command_class=Refit_Create)
|
create_parser.set_defaults(command_class=Refit_Create)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 0
|
major = 0
|
||||||
minor = 2
|
minor = 2
|
||||||
patch = 1
|
patch = 3
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user