Skip to content

Commit

Permalink
write_coverage: add support for --append (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed authored Jul 21, 2018
1 parent df962b4 commit cf9fcd7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions covimerage/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,20 @@ def main(ctx, verbose, quiet, loglevel, rcfile):
@click.option('--source', type=click.types.Path(exists=True), help=(
'Source files/dirs to include. This is necessary to include completely '
'uncovered files.'), show_default=True, multiple=True)
def write_coverage(profile_file, data_file, source):
@click.option('--append', is_flag=True, default=False, show_default=True,
help='Read existing DATA_FILE for appending.')
def write_coverage(profile_file, data_file, source, append):
"""
Parse PROFILE_FILE (output from Vim's :profile) and write it into DATA_FILE
(Coverage.py compatible).
"""
m = MergedProfiles(source=source)
if append:
m = MergedProfiles(source=source, append_to=data_file)
else:
m = MergedProfiles(source=source)

m.add_profile_files(*profile_file)

if not m.write_coveragepy_data(data_file=data_file):
raise CustomClickException('No data to report.')

Expand Down

0 comments on commit cf9fcd7

Please sign in to comment.