Skip to content

Commit 75300f1

Browse files
committed
Add covimerage-run console script
This is required/useful for when a single command is required to wrap Vim, e.g. with vim-thesis.
1 parent bb84cc9 commit 75300f1

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

covimerage/cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
from .logger import logger
1111
from .utils import build_vim_profile_args, join_argv
1212

13+
context_settings = {'help_option_names': ['-h', '--help']}
14+
1315

1416
def default_loglevel():
1517
return logging.getLevelName(logger.level).lower()
1618

1719

18-
@click.group(context_settings={'help_option_names': ['-h', '--help']})
20+
@click.group(context_settings=context_settings)
1921
@click.version_option(get_version(), '-V', '--version', prog_name='covimerage')
2022
@click.option('-v', '--verbose', count=True, help='Increase verbosity.')
2123
@click.option('-q', '--quiet', count=True, help='Decrease verbosity.')
@@ -63,6 +65,7 @@ def write_coverage(profile_file, data_file, source, append):
6365

6466

6567
@main.command(context_settings=dict(
68+
context_settings,
6669
# ignore_unknown_options=True,
6770
allow_interspersed_args=False,
6871
))

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ def run(self):
7373
url='https://github.com/Vimjas/covimerage',
7474
packages=['covimerage'],
7575
entry_points={
76-
'console_scripts': ['covimerage=covimerage.cli:main'],
76+
'console_scripts': [
77+
'covimerage=covimerage.cli:main',
78+
'covimerage-run=covimerage.cli:run',
79+
],
7780
},
7881
use_scm_version={
7982
'write_to': 'covimerage/__version__.py',

tests/test_cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def test_cli_help(arg, runner):
6161
assert result.exit_code == 0
6262

6363

64+
def test_cli_run_shorthelp(runner):
65+
result = runner.invoke(cli.run, ['-h'])
66+
assert result.output.startswith('Usage:')
67+
assert result.exit_code == 0
68+
69+
6470
def test_cli_run_with_args_fd(capfd):
6571
ret = call(['covimerage', 'run', '--profile-file', '/doesnotexist',
6672
'echo', '--', '--no-profile', '%sMARKER'])

0 commit comments

Comments
 (0)