gnucash maint: [gnucash-cli] improve "-R show" to describe report

Christopher Lam clam at code.gnucash.org
Sat Jul 18 07:39:54 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/0b4cd692 (commit)
	from  https://github.com/Gnucash/gnucash/commit/e3029214 (commit)



commit 0b4cd692d7ac8788f8bfc713dce22ba74b6dd2a8
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 18 19:30:42 2020 +0800

    [gnucash-cli] improve "-R show" to describe report
    
    * displays available export types if applicable
    * saved-reports: displays parent report name
    
    eg
    
    * name: GST
      guid: 41c859a223a54913ad323ef166039df0
      parent-template: Income and GST Statement
      export-types: CSV

diff --git a/gnucash/report/report-core.scm b/gnucash/report/report-core.scm
index ee6bbb444..1bc800fbc 100644
--- a/gnucash/report/report-core.scm
+++ b/gnucash/report/report-core.scm
@@ -778,9 +778,22 @@ not found.")))
      (else
       (for-each
        (lambda (template)
-         (let* ((options-gen (gnc:report-template-options-generator template)))
-           (format port "\n* guid: ~a\n~a"
+         (let* ((options-gen (gnc:report-template-options-generator template))
+                (parent-guid (gnc:report-template-parent-type template))
+                (parent-template (and parent-guid
+                                      (hash-ref *gnc:_report-templates_* parent-guid)))
+                (export-types (gnc:report-template-export-types
+                               (or parent-template template))))
+           (format port "\n* name: ~a\n  guid: ~a\n~a~a~a"
+                   (gnc:report-template-name template)
                    (gnc:report-template-report-guid template)
+                   (if parent-template
+                       (format #f "  parent-template: ~a\n"
+                               (gnc:report-template-name parent-template))
+                       "")
+                   (if export-types
+                       (format #f "  export-types: ~a\n"
+                               (string-join (map car export-types) ", ")) "")
                    (gnc:html-render-options-changed (options-gen) #t))))
        templates)))))
 



Summary of changes:
 gnucash/report/report-core.scm | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list