added filemode
This commit is contained in:
@@ -1,15 +1,42 @@
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import configparser
|
||||
|
||||
from modules.refit_logger import logger
|
||||
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---------------------------
|
||||
# Main Parser
|
||||
@@ -39,6 +66,9 @@ create_parser.add_argument(
|
||||
nargs="*",
|
||||
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)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
Reference in New Issue
Block a user