sake icon indicating copy to clipboard operation
sake copied to clipboard

Allow recursive globbing in dependencies

Open tribals opened this issue 4 years ago • 0 comments

From docs:

If recursive is true, the pattern “**” will match any files and zero or more directories, subdirectories and symbolic links to directories. If the pattern is followed by an os.sep or os.altsep then files will not match.

IMO, it would be useful do declare recursive dependencies.

Example. If I need to re-format all sources if they was changed, it can be expressed as target like this:

format:
  help: Re-format all sources
  dependencies:
    - $SOURCES/**/*.py
    - $TESTS/**/*.py
  formula: |
    black $SOURCES $TESTS

Unfortunately, without glob's recursive flag - it isn't possible.

Another option would be to allow user to decide by himself, passing, for example an object as a pattern:

format:
  help: Re-format all sources
  dependencies:
    - pattern: $SOURCES/**/*.py
      recursive: true
    - $TESTS/**/*.py
  formula: |
    black $SOURCES $TESTS

In this example, I decided to glob recursively for sources but not for tests.

tribals avatar Apr 14 '20 17:04 tribals