From 8ccc34fb6d167ab9b142df40e515a89770523323 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Wed, 21 Dec 2016 09:54:41 +0100 Subject: Run sensible-editor to fill in newly created entries. --- lesana/command.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lesana/command.py b/lesana/command.py index e900aad..2beb88b 100644 --- a/lesana/command.py +++ b/lesana/command.py @@ -1,3 +1,7 @@ +import logging +import os +import subprocess + import gadona from . import Collection, Entry @@ -14,6 +18,19 @@ class New(gadona.Command): collection = Collection(self.settings.collection) new_entry = Entry(collection) collection.save_entries([new_entry]) + filepath = os.path.join( + collection.basedir, + 'items', + new_entry.fname + ) + try: + subprocess.call(['sensible-editor', filepath]) + except FileNotFoundError as e: + logging.warning( + "Could not open new file with editor: {}".format(str(e)) + ) + else: + collection.update_cache([filepath]) print(new_entry.fname) -- cgit v1.2.3