Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured File Hook Shared Functions #260

Open
robcxyz opened this issue Jan 1, 2024 · 0 comments
Open

Structured File Hook Shared Functions #260

robcxyz opened this issue Jan 1, 2024 · 0 comments
Labels
considering proposal Proposal for changes in syntax / behaviour

Comments

@robcxyz
Copy link
Collaborator

robcxyz commented Jan 1, 2024

Structured File Hook Shared Functions

Update all the structured file hooks (ie yaml, json, toml, and ini) to have shared functions.

Overview

The yaml, json, toml, and ini share a lot of the same operations and so should have some shared libraries. Right now we have a bloated *_in_place hook. In the future it would be good to have a shared library of operations that each tool wraps.

Supported hooks (yaml as example):

  • yaml_update_key

  • yaml_merge_key

  • yaml_remove_key

  • yaml_pop_key

  • yaml_pop_item

  • yaml_insert_item

  • yaml_append_item

  • yaml_read

Comment Preserving

  • yaml

    • Should on read and write
  • json

    • n/a
  • toml

  • ini

New Hooks

  • yaml_update

    • fields

      • file

      • Optional - key

      • Value

      • in_place - bool

    • Reads yaml and updates

  • yaml_update_in_place

  • yaml_append

  • yaml_delete

  • yaml_pop

  • yaml_get

  • yaml_parse / yaml_read

    • Already have yamldecode / yamlencode

    • Reads a string into a yaml

    • yaml hook by default takes a string to a path. If that is not a path then it should simply throw error and not try to parse as string.

@robcxyz robcxyz changed the title tmp Structured File Hook Shared Functions Jan 1, 2024
@robcxyz robcxyz added proposal Proposal for changes in syntax / behaviour considering labels Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
considering proposal Proposal for changes in syntax / behaviour
Projects
None yet
Development

No branches or pull requests

1 participant