diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vgstash/test_vgstash_cli.py | 9 | ||||
-rw-r--r-- | src/vgstash_cli.py | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/vgstash/test_vgstash_cli.py b/src/vgstash/test_vgstash_cli.py index faf87b2..cbbd151 100644 --- a/src/vgstash/test_vgstash_cli.py +++ b/src/vgstash/test_vgstash_cli.py @@ -142,3 +142,12 @@ def test_list_pretty_tiny(): 'Super Mario Bros. | NES | P | P ', 'The Legend of Zelda | NES | D | P \n' )) + + +def test_delete(): + runner = CliRunner() + result = runner.invoke(vgstash_cli.cli, ['delete', 'Vectorman 2', 'Genesis']) + if verbose: + print(result.output) + assert result.exit_code == 0 + assert result.output == "Removed Vectorman 2 for Genesis from your collection.\n" diff --git a/src/vgstash_cli.py b/src/vgstash_cli.py index 39d2454..f88187c 100644 --- a/src/vgstash_cli.py +++ b/src/vgstash_cli.py @@ -129,3 +129,13 @@ def list_games(filter, raw, width): else: row_format(r, width, first_pass) first_pass = False + + +@cli.command('delete') +@click.argument('title', required=True) +@click.argument('system', required=True) +def delete_game(title, system): + db = get_db() + target_game = vgstash.Game(title, system) + if db.delete_game(target_game): + click.echo("Removed {} for {} from your collection.".format(title, system)) |