Lib for managing .cogs file
Project description
confcogs
confcogs is a lightweight Python library for managing .cogs configuration files. It allows you to easily add, edit, fetch, and remove key-value pairs in .cogs files.
Installation
Install confcogs using pip:
pip install confcogs
Usage
Import the Library
import confcogs
Setting the Path
Set the path to your .cogs file:
path = 'settings/load.cogs'
Adding Key-Value Pairs
Add new key-value pairs:
confcogs.acog(path, 'loaded', 'True')
confcogs.acog(path, 'debug', 'False')
Fetching a Value
Retrieve a value from the .cogs file:
value = confcogs.fcog(path, 'loaded') # Output: 'True'
Editing a Value
Edit an existing value:
confcogs.ecog(path, 'debug', 'True')
Removing a Key
Remove a key-value pair:
confcogs.rcog(path, 'debug')
Loading All Configurations
Load the entire .cogs file as a dictionary:
config = confcogs.lcog(path) # Output: {'loaded': 'True'}
Example
Here’s a complete example:
import confcogs
path = 'settings/load.cogs'
# Add key-value pairs
confcogs.acog(path, 'loaded', 'True')
confcogs.acog(path, 'debug', 'False')
# Fetch a value
print(confcogs.fcog(path, 'loaded')) # Output: True
# Edit a value
confcogs.ecog(path, 'debug', 'True')
# Remove a key
confcogs.rcog(path, 'debug')
# Load all configurations
print(confcogs.lcog(path)) # Output: {'loaded': 'True'}
File Format
.cogs files use a simple key-value format:
key: 'value';
Example:
loaded: 'True';
debug: 'False';
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file confcogs-0.1.0.tar.gz.
File metadata
- Download URL: confcogs-0.1.0.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc555c7a3a8e291dd3079c8d93d702529533efd3af0f2ffb489fd315d19a0a01
|
|
| MD5 |
a9f243e259d88cae1487923a263599e7
|
|
| BLAKE2b-256 |
8ab8f404a80cf70315c0a096024c365eb8876b3b8049ba99331672e69593c213
|
File details
Details for the file confcogs-0.1.0-py3-none-any.whl.
File metadata
- Download URL: confcogs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc97471eebec331042f8954fcf01ddb200cac97575313176292425726df3fb54
|
|
| MD5 |
e2b1e9d711d73b013c0a3ae267083f7e
|
|
| BLAKE2b-256 |
03f78550d5e95cf8153fd54209cdf4f5582fbb2751d274ac270ef9f22b2b1c17
|