config works
This commit is contained in:
@@ -4,7 +4,9 @@ version = "0.1.0"
|
|||||||
description = "An AI enhanced CTF toolchain"
|
description = "An AI enhanced CTF toolchain"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.14"
|
requires-python = ">=3.14"
|
||||||
dependencies = []
|
dependencies = [
|
||||||
|
"platformdirs>=4.9.4",
|
||||||
|
]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["hatchling"]
|
requires = ["hatchling"]
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from ctf import commands
|
from ctf import commands
|
||||||
|
from ctf import utils
|
||||||
def main():
|
def main():
|
||||||
print("Hello from ctf!")
|
print("Hello from ctf!")
|
||||||
|
utils.load_config()
|
||||||
commands.test()
|
commands.test()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
13
src/ctf/utils.py
Normal file
13
src/ctf/utils.py
Normal file
@@ -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)
|
||||||
Reference in New Issue
Block a user