facultyai / faculty-sync

Synchronise a local directory with your Faculty platform workspace
https://pypi.org/project/faculty_sync/
Apache License 2.0
10 stars 1 forks source link

Add `include` flag #11

Open albertofavaro opened 6 years ago

albertofavaro commented 6 years ago

When considering which files to sync, it would be useful to have an include flag as well as the current ignore flag. The list of file types that I plan to include is quite minimal (.py, .md and perhaps .sh). Having an include flag would cater for people who use sml-sync mostly to develop Python.

janfreyberg commented 6 years ago

Thanks @albertofavaro - just to check, what would you expect the behaviour to be in the following cases:

  1. --include="*.py" --ignore="secrets.py"
  2. --include="test.py, test2.py" --ignore="test.py"

I think 1. should work and the ignore should supersede the include, and 2. should raise an error, but would be good to know what you expect to happen. I think given that you can specify ignore arguments in the config, it could be easy to have clashes.

pbugnion commented 6 years ago

Thanks for raising this! Once we've settled on a behaviour, happy to walk you -- or anyone else interested in working on this -- through the steps to get this implemented!

albertofavaro commented 6 years ago

I don't have a strong opinion. I would suggest that the flag --include is a filter that gets applied before the flag --ignore. With this logic, neither of the examples that @janfreyberg put forward would result in an error. They would be interpreted as:

  1. All .py files with the exception of secrets.py are considered.
  2. The file test2.py is considered, whereas test.py is not.