Finally an easy way to validate your folder structure Checkout this sick online demo!
PathSchema is published on Pypi and can be installed using Pip.
pip install pathschema
PathSchema comes with an easy to use command line tool to run a validation on a given folder.
python -m pathschema path/to/.pathschema path/to/folder
More options are available, make sure to take a look at the help files with the --help
argument.
To get started, create a file named .pathschema
. It is usually placed within the target folder you wish to validate
Each line in the schema represents an acceptable path. By default, paths are treated as files but can be changed to be a folder by adding a slash (/
) at the end of the line
You can add comments to document your schema. Simply add a pound sign (#
) at the beginning of the line.
Wildcard characters are supported in the path name by default. For example you can use *.md
to only accept markdown files.
In the cases where a simple wildcard isn't enough, regex can be used to achieve more advance pattern matching. To do so, enclose the name in double quotes like this: "[0-9]{4}"
.
Some path can be made required by using the plus sign (+
) in front of it's name, example: + readme.md
. Similarly, you can make a path forbidden by using the minus sign (-
).
To ignore the content of a folder, use the ellipsis (...
).
Copyright © 2023 | Apollo-Roboto
Powered by Pyscript and Tailwindcss