#23 WIP: Add output templating
Merged by qulogic. Opened by qulogic.
qulogic/golist template  into  master

Download 23.patch

This adds an option --template that is used to determine how output is printed. The given format string is first unquoted (to allow for things like \n) and then passed to Go's builtin templater. This is pretty powerful, but for now, I've just passed the strings that would normally be printed. You can now do something like:

$ golist --package-path pagure.io/golist --imported \
    --template 'BuildRequires: golang({{.}})\n'
BuildRequires: golang(github.com/urfave/cli)
BuildRequires: golang(pagure.io/golist/pkg/util)

It may be possible to insert additional information there, if I pass something more featureful than just the name, but this is probably enough to fix #13.

rebased onto 4d28439731c9bc895a151c97404629b5fc908920

rebased onto 8964398033bb744551cd6b64b4b4c5d9b9ae104b

@qulogic Looks good (not tested). Not sure the \n is necessary for BuildRequires but having the option to put everything on one line may be useful for go test

On some further thought, there's not really any other information we have available for dependencies. So I'll just merge this as is, and we can investigate any additional replacements later.

Pull-Request has been merged by qulogic

Metadata