exec git init
exec lefthook install
exec git config user.email "you@example.com"
exec git config user.name "Your Name"
exec git add -A
exec lefthook run -f all
stdout '^a.txt b.txt dir/a.txt dir/b.txt lefthook.yml\s*$'
exec lefthook run -f oneline
stdout '^lefthook.yml\s*$'
exec lefthook run -f array
stdout '^dir/a.txt dir/b.txt\s*$'
exec lefthook run -f nested
stdout '^lefthook.yml\s+dir/b.txt lefthook.yml\s+b.txt dir/b.txt lefthook.yml\s+b.txt dir/b.txt\s*$'

-- lefthook.yml --
output:
  - execution_out

all:
  commands:
    echo:
      run: echo {staged_files}

oneline:
  commands:
    echo:
      run: echo {staged_files}
      exclude: '*.txt'

array:
  jobs:
    - run: echo {staged_files}
      exclude:
        - a.txt
        - b.txt
        - '*.yml'

nested:
  jobs:
    - exclude:
        - '*.txt'
      run: echo {staged_files}
    - exclude:
        - a.txt
        - dir/a.txt
      group:
        jobs:
          - exclude:
              - b.txt
            run: echo {staged_files}
          - group:
              jobs:
                - run: echo {staged_files}
          - group:
              jobs:
                - exclude:
                    - '*.yml'
                  run: echo {staged_files}
-- a.txt --
a

-- b.txt --
b

-- dir/a.txt --
dir-a

-- dir/b.txt --
dir-b


