mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-29 22:16:13 +02:00
Get rid of --delete
This commit is contained in:
parent
fabb8d5f1b
commit
4d8949bbed
2 changed files with 12 additions and 38 deletions
18
jrnl/cli.py
18
jrnl/cli.py
|
@ -49,7 +49,6 @@ def parse_args(args=None):
|
|||
exporting.add_argument('-o', metavar='OUTPUT', dest='output', help='The output of the file can be provided when using with --export', default=False, const=None)
|
||||
exporting.add_argument('--encrypt', metavar='FILENAME', dest='encrypt', help='Encrypts your existing journal with a new password', nargs='?', default=False, const=None)
|
||||
exporting.add_argument('--decrypt', metavar='FILENAME', dest='decrypt', help='Decrypts your journal and stores it in plain text', nargs='?', default=False, const=None)
|
||||
exporting.add_argument('--delete', dest='delete', help='Deletes the selected entries your journal file.', action="store_true")
|
||||
exporting.add_argument('--edit', dest='edit', help='Opens your editor to edit the selected entries.', action="store_true")
|
||||
|
||||
return parser.parse_args(args)
|
||||
|
@ -58,7 +57,7 @@ def guess_mode(args, config):
|
|||
"""Guesses the mode (compose, read or export) from the given arguments"""
|
||||
compose = True
|
||||
export = False
|
||||
if args.decrypt is not False or args.encrypt is not False or args.export is not False or any((args.short, args.tags, args.delete, args.edit)):
|
||||
if 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)):
|
||||
compose = False
|
||||
export = True
|
||||
elif any((args.start_date, args.end_date, args.limit, args.strict, args.starred)):
|
||||
|
@ -217,21 +216,6 @@ def run(manual_args=None):
|
|||
update_config(original_config, {"encrypt": False}, journal_name, force_local=True)
|
||||
install.save_config(original_config, config_path=CONFIG_PATH)
|
||||
|
||||
elif args.delete:
|
||||
other_entries = [e for e in old_entries if e not in journal.entries]
|
||||
util.prompt("Following entries will be deleted:")
|
||||
for e in journal.entries[:10]:
|
||||
util.prompt(" "+e.pprint(short=True))
|
||||
if len(journal) > 10:
|
||||
q = "...and {0} more. Do you really want to delete these entries?".format(len(journal) - 10)
|
||||
else:
|
||||
q = "Do you really want to delete these entries?"
|
||||
ok = util.yesno(q, default=False)
|
||||
if ok:
|
||||
util.prompt("[Deleted {0} entries]".format(len(journal)))
|
||||
journal.entries = other_entries
|
||||
journal.write()
|
||||
|
||||
elif args.edit:
|
||||
other_entries = [e for e in old_entries if e not in journal.entries]
|
||||
# Edit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue