Add --delete for interactive removal of entries (#698)

* Add --delete for interactive removal of entries
* Add inquirer dependency for fancy prompting
* Fix some minor style issues
* Fix #434 
* Use PyInquirer instead of inquirer for Windows compatibility
* Add WIP (broken) test
* Change deletion interface to be more basic
* Update environment.py

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
This commit is contained in:
Aaron Lichtman 2020-03-21 14:32:20 -05:00
parent d4a0895163
commit f4fca3e5a4
5 changed files with 54 additions and 1 deletions

View file

@ -174,6 +174,13 @@ def parse_args(args=None):
action="store_true",
)
exporting.add_argument(
"--delete",
dest="delete",
action="store_true",
help="Opens an interactive interface for deleting entries.",
)
# Handle '-123' as a shortcut for '-n 123'
num = re.compile(r"^-(\d+)$")
if args is None:
@ -194,7 +201,7 @@ def guess_mode(args, config):
args.decrypt is not False
or args.encrypt is not False
or args.export is not False
or any((args.short, args.tags, args.edit))
or any((args.short, args.tags, args.edit, args.delete))
):
compose = False
export = True
@ -456,3 +463,7 @@ def run(manual_args=None):
journal.entries += other_entries
journal.sort()
journal.write()
elif args.delete:
journal.prompt_delete_entries()
journal.write()