introduced src

This commit is contained in:
2025-09-27 20:53:07 +02:00
parent b3834f4798
commit 8bc7bf5584
2 changed files with 94 additions and 0 deletions

62
refit/src/refit.py Normal file
View File

@@ -0,0 +1,62 @@
import argparse
import sys
from modules.refit_logger import logger
# Setting Global Variables
REFIT_VERSION = "Refit Beta 0.0.0"
# ---------------------------BEGIN FUNCTIONS---------------------------
# will be in seperate file at some point
def refit_create(args):
logger.info("Running in create mode")
logger.debug(f"Arguments: {args}")
print(f"executing on {args.input}")
# ----------------------------END FUNCTIONS----------------------------
# ---------------------------ARGPARSE START---------------------------
# Main Parser
parser = argparse.ArgumentParser(
prog="Refit",
description="This is a file and directory manipulation tool.\
it can create, move and delete files and directories as well as \
renaming them",
epilog=REFIT_VERSION,
)
# Main Parser Arguments
# Create Parser
subparser = parser.add_subparsers(
title="Commands",
dest="create",
required=False,
)
# Create Parser Arguments
create_parser = subparser.add_parser(
"create",
help="creates a new file/folder",
)
create_parser.add_argument("-n", type=int, help="number of items")
create_parser.add_argument("-i", "--input", help="input file")
create_parser.set_defaults(func=refit_create)
args = parser.parse_args()
# ---------------------------ARGPARSE END-----------------------------
# Dispatcher
if hasattr(args, "func"):
logger.debug("In hasattr()")
args.func(args)
else:
parser.print_help()
logger.info("No input, exiting with error:1")
sys.exit(1)