Sfoglia il codice sorgente

Add CLI option to open generated invoice

Signed-off-by: Peter Hatina <peter@hatina.eu>
master
Peter Hatina 11 mesi fa
parent
commit
81dcd5e4c5
1 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. +5
    -3
      lib/invoice/cli.py

+ 5
- 3
lib/invoice/cli.py Vedi File

@@ -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…
Annulla
Salva