Skip to main content

A configuration file handling library supporting INI, JSON, and YAML formats

Project description

JYC - Advanced File Content Operation Tool

License Blog

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 index
  • items[*]: Access all array elements
  • items[?class=web]: Conditional filtering
  • items[?name~=^test]: Regex matching
  • items..name: Recursive search
  • items[1:3]: Slice operation
  • items[*].price@sum: Aggregation operation
  • items@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 interface
  • FileHandler.py: Base class for file operations
  • getValue.py: Core logic for path expression parsing and evaluation

Contributing

Contributions are welcome! Feel free to:

  1. Fork the repository
  2. Create your feature branch
  3. Submit a Pull Request

About the Author

Acknowledgments

Thanks to all contributors who have helped make this project better!


If you find this project helpful, please give it a star ⭐️

View more project details

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

jyc-0.1.11.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jyc-0.1.11-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

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

Hashes for jyc-0.1.11.tar.gz
Algorithm Hash digest
SHA256 8eac199683a248b45c10c9a2df1a21dd82fd5458fa43a1f25b27cde0353b24c7
MD5 f2c0cb4ac882c0bf5a704a5c80856b90
BLAKE2b-256 4f04ba5154fa13444c3051fccc82187ac36d615ccac80a3e6f48ea1b212be6b7

See more details on using hashes here.

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

Hashes for jyc-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 4ddec85acf5e3996ae1fb77cd95da16e1d5a55d6c03bf64c57693582934cb0fe
MD5 1a3546a69d5a0e550db926d403699043
BLAKE2b-256 c9b640466baca2654448a7acbbd2c1cb49d5727f7cf7337be89fe085e12099ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page