summaryrefslogtreecommitdiff
path: root/src/vgstash_cli.py
diff options
context:
space:
mode:
authorzlg <zlg@zlg.space>2018-10-06 22:28:40 -0700
committerzlg <zlg@zlg.space>2018-10-06 22:28:40 -0700
commit9da20483b8aa26a3090093212d007e6dc756b2d2 (patch)
treeaf58054f45cff31871109c4a7591d8329cd07686 /src/vgstash_cli.py
parentRemove ID field from DB (diff)
downloadvgstash-9da20483b8aa26a3090093212d007e6dc756b2d2.tar.gz
vgstash-9da20483b8aa26a3090093212d007e6dc756b2d2.tar.bz2
vgstash-9da20483b8aa26a3090093212d007e6dc756b2d2.tar.xz
vgstash-9da20483b8aa26a3090093212d007e6dc756b2d2.zip
cli: Add "delete" command
Unlike the old version of vgstash, the new one does not accept row IDs as arguments for removal. Instead, it accepts two mandatory arguments: the title of the game, and the system it's on. This is in line with the database itself, using the title and system as primary keys.
Diffstat (limited to 'src/vgstash_cli.py')
-rw-r--r--src/vgstash_cli.py10
1 files changed, 10 insertions, 0 deletions
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))