config-file-validator icon indicating copy to clipboard operation
config-file-validator copied to clipboard

[FEATURE REQUEST] Add support for glob patterns

Open olunusib opened this issue 1 year ago • 5 comments

Description

Add support for glob patterns to allow more flexible and precise file matching

Examples:

validator "**/*.json" # validate all json files

validator "config/**/*_prod.yaml"  # validate only YAML files with '_prod' in their name within the config directory

olunusib avatar Aug 23 '24 04:08 olunusib

@olunusib Great suggestion! Just to make sure I'm understanding your first example (validator "**/*.json" # validate all json files) how does that differ from the functionality today?

kehoecj avatar Aug 27 '24 13:08 kehoecj

I would suggest using doublestar

ccoVeille avatar Aug 27 '24 19:08 ccoVeille

True, the first example is already doable with an extra flag

olunusib avatar Aug 31 '24 00:08 olunusib

@olunusib @kehoecj what flag are you referring to for the first example?

anya004 avatar Sep 29 '24 14:09 anya004

@anya004 Looking at this more there's actually not a great way to target only one file type so I think the glob pattern makes sense. In order to target only a single config type you'd have to exclude all available types like this validator --exclude-type=xml,yaml,.... Looking at it further we also don't provide a list of types that are visible outside of the code. I'll create a separate issue for that.

kehoecj avatar Oct 02 '24 20:10 kehoecj

@kehoecj I can look into it. Would integrate the doublestar library mentioned above.

timwehrle avatar Oct 11 '24 06:10 timwehrle

@timwehrle I started looking into it and will have a PR ready today!

anya004 avatar Oct 11 '24 08:10 anya004

@anya004 If you need additional help, reach out :)

timwehrle avatar Oct 11 '24 08:10 timwehrle