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.

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.9.tar.gz (40.8 MB 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.9-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file jyc-0.1.9.tar.gz.

File metadata

  • Download URL: jyc-0.1.9.tar.gz
  • Upload date:
  • Size: 40.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/5.15.0-125-generic

File hashes

Hashes for jyc-0.1.9.tar.gz
Algorithm Hash digest
SHA256 84ca2474d82042159fd2dc097f328c6e16e2f0a50aed0a6744f1dbe2854a0286
MD5 fba2102b3d47f33881967ee96b4646cf
BLAKE2b-256 617529e3afff1d912a3332fcbed2e388f0105b7e37d39c9abcf9880320ac6fc9

See more details on using hashes here.

File details

Details for the file jyc-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: jyc-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/5.15.0-125-generic

File hashes

Hashes for jyc-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ba651eda6b16503b6451039fb72bc2001421e82eddec0367fc485b4ce5132e78
MD5 b7c4e40cc21185c3b6b898b08d85379b
BLAKE2b-256 3ffe13f20e07cc2a1e6a97b280c126da4c56050ede04d57293b8a81cff7ae9ae

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