diff --git a/changelog_binder/cli.py b/changelog_binder/cli.py index 060948f..dda1412 100644 --- a/changelog_binder/cli.py +++ b/changelog_binder/cli.py @@ -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 diff --git a/tests/test_cli.py b/tests/test_cli.py index 052c336..3e4658a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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