nncli

NextCloud Notes Command Line Interface
git clone git://git.danielmoch.com/nncli.git
Log | Files | Refs | LICENSE

commit e8e17905975358f459c6223167c17e523849cddf
parent c9b9b2123c241ca9910b8d479e6f345a89086523
Author: Matthias Kauer <mk.software@zuez.org>
Date:   Sat, 28 Oct 2017 15:17:12 +0800

(WIP) open editor in the current line

Diffstat:
Msimplenote_cli/config.py | 2+-
Msimplenote_cli/sncli.py | 5++++-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/simplenote_cli/config.py b/simplenote_cli/config.py @@ -20,7 +20,7 @@ def __init__(self, custom_file=None): 'cfg_format_strftime' : '%Y/%m/%d', 'cfg_format_note_title' : '[%D] %F %-N %T', 'cfg_status_bar' : 'yes', - 'cfg_editor' : 'vim', + 'cfg_editor' : 'vim {fname} +{line}', 'cfg_pager' : 'less -c', 'cfg_diff' : 'diff -b -U10', 'cfg_max_logs' : '5', diff --git a/simplenote_cli/sncli.py b/simplenote_cli/sncli.py @@ -96,9 +96,12 @@ def exec_cmd_on_note(self, note, cmd=None, raw=False): return None tf = temp.tempfile_create(note if note else None, raw=raw, tempdir=self.tempdir) + lb = self.gui_body_get() + cmd_list = [c.format(line=lb.focus_position + 1, fname=temp.tempfile_name(tf)) for c in cmd.split(" ")] + self.log("EXECUTING {}".format(cmd_list)) try: - subprocess.check_call(cmd + ' ' + temp.tempfile_name(tf), shell=True) + subprocess.check_call(cmd_list) except Exception as e: self.log('Command error: ' + str(e)) temp.tempfile_delete(tf)