mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
parent
65b4d5ffa0
commit
5b4b1e71d6
4 changed files with 17 additions and 7 deletions
|
@ -1,6 +1,10 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
### 1.0.4
|
||||
|
||||
* [Improved] Python 2.6 compatibility
|
||||
|
||||
### 1.0.3 (April 17, 2013)
|
||||
|
||||
* [Improved] Installs pycrypto by default
|
||||
|
|
12
jrnl/jrnl.py
12
jrnl/jrnl.py
|
@ -87,14 +87,14 @@ def encrypt(journal, filename=None):
|
|||
journal.make_key(prompt="Enter new password:")
|
||||
journal.config['encrypt'] = True
|
||||
journal.write(filename)
|
||||
print("Journal encrypted to {}.".format(filename or journal.config['journal']))
|
||||
print("Journal encrypted to {0}.".format(filename or journal.config['journal']))
|
||||
|
||||
def decrypt(journal, filename=None):
|
||||
""" Decrypts into new file. If filename is not set, we encrypt the journal file itself. """
|
||||
journal.config['encrypt'] = False
|
||||
journal.config['password'] = ""
|
||||
journal.write(filename)
|
||||
print("Journal decrypted to {}.".format(filename or journal.config['journal']))
|
||||
print("Journal decrypted to {0}.".format(filename or journal.config['journal']))
|
||||
|
||||
def print_tags(journal):
|
||||
"""Prints a list of all tags and the number of occurances."""
|
||||
|
@ -105,20 +105,20 @@ def print_tags(journal):
|
|||
for tag in set(entry.tags)
|
||||
]
|
||||
# To be read: [for entry in journal.entries: for tag in set(entry.tags): tag]
|
||||
tag_counts = {(tags.count(tag), tag) for tag in tags}
|
||||
tag_counts = set([(tags.count(tag), tag) for tag in tags])
|
||||
if not tag_counts:
|
||||
print('[No tags found in journal.]')
|
||||
elif min(tag_counts)[0] == 0:
|
||||
tag_counts = filter(lambda x: x[0] > 1, tag_counts)
|
||||
print('[Removed tags that appear only once.]')
|
||||
for n, tag in sorted(tag_counts, reverse=False):
|
||||
print("{:20} : {}".format(tag, n))
|
||||
print("{0:20} : {1}".format(tag, n))
|
||||
|
||||
|
||||
def touch_journal(filename):
|
||||
"""If filename does not exist, touch the file"""
|
||||
if not os.path.exists(filename):
|
||||
print("[Journal created at {}]".format(filename))
|
||||
print("[Journal created at {0}]".format(filename))
|
||||
open(filename, 'a').close()
|
||||
|
||||
def update_config(config, new_config, scope):
|
||||
|
@ -185,7 +185,7 @@ def cli():
|
|||
raw = " ".join(args.text).strip()
|
||||
entry = journal.new_entry(raw, args.date)
|
||||
entry.starred = args.star
|
||||
print("[Entry added to {} journal]").format(journal_name)
|
||||
print("[Entry added to {0} journal]").format(journal_name)
|
||||
journal.write()
|
||||
|
||||
# Reading mode
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
parsedatetime >= 1.1.2
|
||||
colorama >= 0.2.5
|
||||
pycrypto >= 2.6
|
||||
argparse==1.2.1
|
||||
|
|
7
setup.py
7
setup.py
|
@ -58,6 +58,11 @@ def get_version(filename="jrnl/__init__.py"):
|
|||
if m:
|
||||
return m.group(1)
|
||||
|
||||
conditional_dependencies = {
|
||||
"pyreadline>=2.0": "win32" in sys.platform,
|
||||
"argparse==1.2.1": sys.version.startswith("2.6")
|
||||
}
|
||||
|
||||
setup(
|
||||
name = "jrnl",
|
||||
version = get_version(),
|
||||
|
@ -67,7 +72,7 @@ setup(
|
|||
"parsedatetime>=1.1.2",
|
||||
"colorama>=0.2.5",
|
||||
"pycrypto>=2.6"
|
||||
] + ["pyreadline>=2.0"] if "win" in sys.platform else [],
|
||||
] + [p for p, cond in conditional_dependencies.items() if cond],
|
||||
long_description=__doc__,
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
|
|
Loading…
Add table
Reference in a new issue