lunduke-cli/config/create_config.py

28 lines
687 B
Python

import os
import toml
def create_sample_config(config_path="config.toml"):
"""Create a sample configuration file if it doesn't exist"""
if os.path.exists(config_path):
print(f"Configuration file already exists: {config_path}")
return
config_data = {
"user": {
"username": "joe_doakes"
},
"api": {
"key_file": "../keys/cli_key.txt",
"host": "discourse.forum.com"
}
}
with open(config_path, "w") as config_file:
toml.dump(config_data, config_file)
print(f"Created sample configuration file: {config_path}")
# Create a sample configuration file
create_sample_config()