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

Feature Request: Comments in metadata .json file #94

Open
rkrug opened this issue Dec 6, 2023 · 4 comments
Open

Feature Request: Comments in metadata .json file #94

rkrug opened this issue Dec 6, 2023 · 4 comments
Assignees

Comments

@rkrug
Copy link

rkrug commented Dec 6, 2023

I am using a .json file (based on the template) to define my metadata. But I like to have comments in the metadata file, to e.g. comment certain values out, explain things, etc. So I decided to implement the rule that each key starting with a _ is a commend. So I use the following now:

metadata <- system.file(
        package = "zenDep",
        params$metadata_file
    ) |>
    jsonlite::read_json()
    
# And filter oput al fields starting with "_" as they are considered comments
metadata <- metadata[grep("^_", names(metadata), invert = TRUE)]

cli$deposit_fill_metadata(metadata)

It would be great, if this could be implemented in the cli$deposit_fill_metadata(filename) function.

If you think there is a better option then using _ (e.g. double underscore?), please let me know. I used the underscore, as it is in the template for the note at the beginning.

@mpadge
Copy link
Member

mpadge commented Dec 6, 2023

Good point. Would you like to submit a PR with that impovement? The line you have above with suffice, although pattern should be "^\\_" instead of "^_", and the best place would be just before this line:

meta <- meta [which (lapply (meta, length) > 0L)]

Thanks

@rkrug
Copy link
Author

rkrug commented Dec 6, 2023

Will do so - but not today - but probably beginning of next week. Added to my TODO list.

@rkrug
Copy link
Author

rkrug commented Dec 6, 2023

Please feel free to assign it to me (if it works)

@mpadge
Copy link
Member

mpadge commented Dec 6, 2023

Great, thanks. Next week will be fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants