You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Siegfried Goeschl (Jira)" <ji...@apache.org> on 2020/02/28 16:34:00 UTC

[jira] [Assigned] (FREEMARKER-135) freemarker-generator-cli: Support user-supplied names for datasources

     [ https://issues.apache.org/jira/browse/FREEMARKER-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Siegfried Goeschl reassigned FREEMARKER-135:
--------------------------------------------

    Assignee: Siegfried Goeschl

> freemarker-generator-cli: Support user-supplied names for datasources
> ---------------------------------------------------------------------
>
>                 Key: FREEMARKER-135
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-135
>             Project: Apache Freemarker
>          Issue Type: Task
>            Reporter: Siegfried Goeschl
>            Assignee: Siegfried Goeschl
>            Priority: Major
>
> The current implementation of `freemarker-cli` provides all datasources as collection to be rendered with the template. Individual datasources can be accessed via index or wildcard search based on the underlying file name. This forces the user to pass the datasources in the correct order when the template process more than on datasource.
> So we want to allow the naming of the datasources on the command line.
> A few thoughts along the line
> * A user might also want to provide additional metadata, e.g. `charset` or `mimetype` 
> * We want to support positional parameters with `Picocli` so all that information should go into a single string
> The following usage shall be supported
> {noformat}
> # Single positional parameter 
> > freemarker-cli -t templates/info.ftl users.csv
> > freemarker-cli -t templates/info.ftl file:///users.csv
> # Multiple positional parameters
> > freemarker-cli -t templates/info.ftl users.csv transactions.csv
> > freemarker-cli -t templates/info.ftl users.csv file:///transactions.csv
> > freemarker-cli -t templates/info.ftl file:///users.csv file:///transactions.csv
> # Short option
> > freemarker-cli -t templates/info.ftl -d users.csv
> > freemarker-cli -t templates/info.ftl -d file:///users.csv
> > freemarker-cli -t templates/info.ftl -d file:///users.csv -d file:///transactions.csv
> # Long option
> > freemarker-cli -t templates/info.ftl --datasource users.csv
> > freemarker-cli -t templates/info.ftl --datasource file:///users.csv
> > freemarker-cli -t templates/info.ftl --datasource file:///users.csv --datasource file:///transactions.csv
> # Named datasource using file name
> > freemarker-cli -t templates/info.ftl users=users.csv
> > freemarker-cli -t templates/info.ftl -d users=users.csv
> > freemarker-cli -t templates/info.ftl --datasource users=users.csv
> # Named datasource using URI
> > freemarker-cli -t templates/info.ftl -d users=file:///users.csv
> > freemarker-cli -t templates/info.ftl --datasource users=users.csv
> # Named datasource using URI and fragments
> > freemarker-cli -t templates/info.ftl -d users=file:///users.csv#charset=UTF-16
> > freemarker-cli -t templates/info.ftl --datasource users=file:///users.csv#charset=UTF-16
> # Named datasource using URI and fragments with multiple parameters
> > freemarker-cli -t templates/info.ftl --datasource users=file:///users.csv#charset=UTF-16&mimetype=text/csv
> # Mix and match the various options
> > freemarker-cli -t templates/info.ftl --datasource users=file:///users.csv transactions=transactions.csv 
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)