Преглед на файлове

Add CLI option to open generated invoice

Signed-off-by: Peter Hatina <peter@hatina.eu>
master
Peter Hatina преди 11 месеца
родител
ревизия
81dcd5e4c5
променени са 1 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. +5
    -3
      lib/invoice/cli.py

+ 5
- 3
lib/invoice/cli.py Целия файл

@@ -77,6 +77,7 @@ class Application:
subparser = subparsers.add_parser(action+suffix, help=method.__doc__)
if method == self.do_pdf:
subparser.add_argument("--generate", "-g", action="store_true")
subparser.add_argument("--view", "-v", action="store_true")
if action == "delete":
subparser.add_argument("--force", "-f", action="store_true")
if action == "new":
@@ -158,7 +159,7 @@ class Application:
item = self.db.invoices[selector]
self._show(item._path)

def do_pdf(self, selector, generate):
def do_pdf(self, selector, generate, view):
"""Generate and view a PDF invoice.

This requires Tempita 0.5.
@@ -214,8 +215,9 @@ class Application:
os.rename(tmp_pdf_file, pdf_file)

assert(os.path.exists(pdf_file))
#log.debug("Running PDF viewer...")
#subprocess.call((self.pdf_program, pdf_file))
if view:
log.debug("Running PDF viewer...")
subprocess.call((self.pdf_program, pdf_file))

def _check_path(self, path):
if not os.path.exists(path):


Loading…
Отказ
Запис