summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bibtool/cli.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bibtool/cli.py b/bibtool/cli.py
index 74855b9..8f29588 100644
--- a/bibtool/cli.py
+++ b/bibtool/cli.py
@@ -22,7 +22,8 @@ def cli():
@cli.command('import')
@click.argument('filename', type=TYPE_FILE)
@click.option('--directory', type=TYPE_DIR, default=os.getcwd())
-def _import(filename, directory):
+@click.option('--delete/--no-delete', default=False)
+def _import(filename, directory, delete):
bibtex_data = bibtool.extract.get_bibtex_data(filename)
if not bibtex_data.entries:
@@ -57,3 +58,7 @@ def _import(filename, directory):
shutil.copy(filename, outfilename)
click.echo('Added {} to the repository.'.format(entry['ID']))
+
+ if delete:
+ os.remove(filename)
+ click.echo('Deleted {}.'.format(filename))