A configuration file handling library supporting INI, JSON, and YAML formats
Project description
JYC - Advanced File Content Operation Tool
JYC is an advanced file content operation tool designed for developers to efficiently perform file data querying, modification, addition, and deletion operations. The tool supports multiple file formats, including JSON, YAML, and configuration files, providing a powerful command-line interface for handling complex data operation requirements.
Notes
- ⚠️ There must be no comments in all configuration files. If there are any comments, they will be deleted. Please copy the original file with comments if necessary
- ⚠️ There must be no comments in json files!!! The format of json files with comments will change
Features
- 📂 Support for multiple file formats (JSON, YAML, Config files)
- 🔍 Powerful query functionality with complex expression support
- ✏️ Support for data addition, modification, and deletion
- 🎨 Formatted output for better readability
- 🛠️ Advanced path expression support, including index access, conditional filtering, recursive search, etc.
Tech Stack
- Python 3.x
- Pygments: For formatted color text output
- JSON, YAML: For handling different types of data files
Installation
Ensure you have Python 3 and pip installed on your system. Then follow these steps:
# Clone repository
git clone https://github.com/Li-yubo/JYC.git
cd JYC
# Install dependencies
pip install -r requirements.txt
Usage
Use the command-line interface for operations:
python app.py <file> --key <key_path> [options]
Options
--add, -a: Add new data to specified key--delete, -d: Delete data at specified key--set, -s: Modify data at specified key--get, -g: Get data from specified key--key, -k: Specify operation key path--addkey, -ak: Specify key or index for add operation--value, -v: Specify value for add or modify operations--pretty, -p: Output formatted data
Advanced Path Expressions
The tool supports various advanced path expressions:
items[0]: Access array indexitems[*]: Access all array elementsitems[?class=web]: Conditional filteringitems[?name~=^test]: Regex matchingitems..name: Recursive searchitems[1:3]: Slice operationitems[*].price@sum: Aggregation operationitems@sort(price): Sorting operation
Examples
Get specific data from JSON file:
python app.py example.json --get -k "items[?name=='example'].value"
Add new data to JSON file:
python app.py example.json --add -k "items" --addkey "newKey" --value "{\"new\":\"data\"}" -p
Modify existing data:
python app.py example.json --set -k "items[0].name" --value "newName" -p
Delete data:
python app.py example.json --delete -k "items[0]"
Development
The project consists of three main components:
app.py: Main entry point and command-line interfaceFileHandler.py: Base class for file operationsgetValue.py: Core logic for path expression parsing and evaluation
Contributing
Contributions are welcome! Feel free to:
- Fork the repository
- Create your feature branch
- Submit a Pull Request
About the Author
- Blog: www.yubo.ltd
- GitHub: Li-yubo
Acknowledgments
Thanks to all contributors who have helped make this project better!
If you find this project helpful, please give it a star ⭐️
Future Enhancements
- Support for more file formats
- Enhanced error handling and reporting
- Performance optimizations
- GUI interface
- API integration capabilities
For more information and updates, visit the project repository.
Project details
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 jyc-0.1.11.tar.gz.
File metadata
- Download URL: jyc-0.1.11.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/5.15.0-94-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8eac199683a248b45c10c9a2df1a21dd82fd5458fa43a1f25b27cde0353b24c7
|
|
| MD5 |
f2c0cb4ac882c0bf5a704a5c80856b90
|
|
| BLAKE2b-256 |
4f04ba5154fa13444c3051fccc82187ac36d615ccac80a3e6f48ea1b212be6b7
|
File details
Details for the file jyc-0.1.11-py3-none-any.whl.
File metadata
- Download URL: jyc-0.1.11-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/5.15.0-94-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ddec85acf5e3996ae1fb77cd95da16e1d5a55d6c03bf64c57693582934cb0fe
|
|
| MD5 |
1a3546a69d5a0e550db926d403699043
|
|
| BLAKE2b-256 |
c9b640466baca2654448a7acbbd2c1cb49d5727f7cf7337be89fe085e12099ee
|