Skip to content

Commit

Permalink
cli: add list command stub
Browse files Browse the repository at this point in the history
See: #4
  • Loading branch information
NicolasT committed Feb 2, 2021
1 parent ebddd15 commit bdbfea7
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
35 changes: 34 additions & 1 deletion changelog_binder/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
import click


@click.command()
@click.group()
def main():
"""Main entry-point of the changelog-binder tool"""


@main.command()
@click.option(
"--in",
"in_",
metavar="VERSION",
help=" ".join(
[
"List all fragments included in the given version,",
"and not in its preceding version",
]
),
)
@click.option(
"--from",
"from_",
metavar="VERSION",
help=" ".join(
[
"List all fragments from the given version and up to either HEAD",
"or the version passed using the '--to' argument",
]
),
)
@click.option(
"--to",
metavar="VERSION",
help="List all fragments up to the given version",
)
def list(in_, from_, to):
"""List fragments that will be rendered"""
raise NotImplementedError
26 changes: 26 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,29 @@ def test_main():
runner = CliRunner()
result = runner.invoke(cli.main)
assert result.exit_code == 0


def test_list():
runner = CliRunner()
result = runner.invoke(cli.main, ["list"])
assert result.exit_code == 1


def test_list_in():
runner = CliRunner()
result = runner.invoke(cli.main, ["list", "--in", "0.1.0"])
assert result.exit_code == 1


def test_list_from_to():
runner = CliRunner()
result = runner.invoke(
cli.main, ["list", "--from", "0.1.0", "--to", "0.2.0"]
)
assert result.exit_code == 1


def test_list_from():
runner = CliRunner()
result = runner.invoke(cli.main, ["list", "--from", "0.1.0"])
assert result.exit_code == 1

0 comments on commit bdbfea7

Please sign in to comment.