From b208cc2ddb43f639096c40067429c15c480e8e52 Mon Sep 17 00:00:00 2001 From: venus Date: Sun, 5 Apr 2026 23:31:32 -0500 Subject: [PATCH] config works --- pyproject.toml | 4 +++- src/ctf/main.py | 2 ++ src/ctf/utils.py | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/ctf/utils.py diff --git a/pyproject.toml b/pyproject.toml index bfe8cdd..1fc1f79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,9 @@ version = "0.1.0" description = "An AI enhanced CTF toolchain" readme = "README.md" requires-python = ">=3.14" -dependencies = [] +dependencies = [ + "platformdirs>=4.9.4", +] [build-system] requires = ["hatchling"] diff --git a/src/ctf/main.py b/src/ctf/main.py index fe81f35..7f8299f 100644 --- a/src/ctf/main.py +++ b/src/ctf/main.py @@ -3,8 +3,10 @@ import argparse from ctf import commands +from ctf import utils def main(): print("Hello from ctf!") + utils.load_config() commands.test() diff --git a/src/ctf/utils.py b/src/ctf/utils.py new file mode 100644 index 0000000..e433674 --- /dev/null +++ b/src/ctf/utils.py @@ -0,0 +1,13 @@ +# src/ctf/utils.py +# basic utilities + +import tomllib +from pathlib import Path +from platformdirs import user_config_dir +# Parse config file +CONFIG_DIR = Path(user_config_dir("ctf")) #config directory is $XDG_CONFIG_HOME/ctf/ +CONFIG_DIR = Path("/home/venus/code/ctf/") +CONFIG_FILE = CONFIG_DIR / "config.toml" + +def load_config(): + print(CONFIG_FILE)