made some minor adjustments

This commit is contained in:
2025-09-28 09:25:08 +02:00
parent a26367c0aa
commit 09563a997c
3 changed files with 12 additions and 13 deletions

View File

@@ -5,12 +5,13 @@ from modules.tempbox_functions import execute_as_subprocess
from modules.tempbox_logger import logger
tempbox_version = "Tempbox Beta b0.2.1"
# Argument parsing
parser = argparse.ArgumentParser(
prog="tempbox",
description="This program accepts an\
command whicht it executes in an temporary directory in /temp.",
# epilog="helloooooooo",
epilog=tempbox_version,
)
parser.add_argument(
@@ -19,20 +20,19 @@ parser.add_argument(
action="store_true",
help="Activates or deactivates verbose output. (default=%(default)s)",
)
parser.add_argument(
"-c",
"--command",
help="Takes the string right after the flag to execute it.",
)
parser.add_argument("-V", "--version", action="version", version=tempbox_version)
args = parser.parse_args()
# Begin of script logic
if args.command is not None:
with tempfile.TemporaryDirectory() as temp_dir:
logger.debug(f"'{temp_dir}' was created")
logger.info(f"'{temp_dir}' was created")
if args.command is not None:
execute_as_subprocess(
args.command,
@@ -41,7 +41,4 @@ if args.command is not None:
)
else:
parser.print_help()
logger.info("Printed Version")
# Creates a temporary directory and executes the command in it.
logger.debug("Printed Version")