Clean up help screen, get rid of util.py (#1027)

* More refactoring of cli.py

break up code from cli.py (now in jrnl.py) up into smaller functions
get rid of export mode
move --encrypt and --decrypt to commands.py
clean up the help screen even more
update flag name for import

* reorganize code, move around lots of functions

* clean up import statements

* move run function out of cli and into jrnl

* rename confusingly named function

* move editor function into editor file

* rename parse_args.py to args.py to make room for more args functions

* Fix error in test suite for windows

I accidentally flipped the conditional, so this fixes it.

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>

* Update app description on help screen

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
Jonathan Wren 2020-08-22 11:40:39 -07:00 committed by GitHub
parent 7c3abb2625
commit 631e08a557
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 981 additions and 775 deletions

View file

@ -6,9 +6,9 @@ import os
import re
import sys
from jrnl import Entry, time, util
log = logging.getLogger(__name__)
from . import Entry
from . import time
from .prompt import yesno
class Tag:
@ -56,7 +56,7 @@ class Journal:
another journal object"""
new_journal = cls(other.name, **other.config)
new_journal.entries = other.entries
log.debug(
logging.debug(
"Imported %d entries from %s to %s",
len(new_journal),
other.__class__.__name__,
@ -85,7 +85,7 @@ class Journal:
text = self._load(filename)
self.entries = self._parse(text)
self.sort()
log.debug("opened %s with %d entries", self.__class__.__name__, len(self))
logging.debug("opened %s with %d entries", self.__class__.__name__, len(self))
return self
def write(self, filename=None):
@ -248,9 +248,7 @@ class Journal:
to_delete = []
def ask_delete(entry):
return util.yesno(
f"Delete entry '{entry.pprint(short=True)}'?", default=False,
)
return yesno(f"Delete entry '{entry.pprint(short=True)}'?", default=False,)
for entry in self.entries:
if ask_delete(entry):