Kexi/Plugins/Reports/CLI Export

From KDE Community Wiki
< Kexi‎ | Plugins‎ | Reports

Design document.

Details:

Add command line (CLI) support for exporting Kexi Reports.

General command line schema:

kexi --export report:NAME [--format=FORMAT] [--overwrite] [--open-after-export] [--output=FILE] project.kexi

Where:

  • NAME - report name (not caption), required
  • FORMAT: One of PDF, ODT, ODS, HTML, OLDHTML. Case-insensitive.
    • The default format is PDF
    • ODT means OpenDocument Text (available is Kexi has support for handling this format installed)
    • ODS means OpenDocument Sheet (available is Kexi has support for handling this format installed)
    • HTML means HTML web page with use of CSS and DIV elements
    • OLDHTML means a traditional HTML web page with use of TABLE elements
  • --overwrite - if the destination file exists, overwrite it; off by default
  • --open-after-export - open associated file viewer after a successful export, e.g. for HTML web browser is used
  • FILE - output file
    • If not specified, NAME.EXTENSION is used, where NAME is the report name and EXTENSION is an extension depending on the format, e.g. pdf for the PDF format
    • Use "-" for standard output, useful for using in scripts; use wit hcare when multiple reports are listed in --export because the output will be concatenated
    • Export will fail if FILE is specified and multiple reports are listed in --export
  • project.kexi - actual project to export from

Requirements

  • Do not require any interaction
  • Support sane defaults

TODOs

  • Nice to have: support export of multiple reports in one go by specifying, e.g. --export report:NAME1,NAME2,....
  • Nice to have: support regular expressions for NAME, e.g. --export "report:.*" for all reports or --export "report:a.*z" for reports with name starting with "a" and ending with "z"
    • Note that " " should be added in the argument because otherwise * will be expanded by the shell.