clog-tool / clog-cli

Generate beautiful changelogs from your Git commit history
MIT License
851 stars 43 forks source link

feat(writer): add writer abstraction so they can be swapped out #57

Closed 0x-r4bbit closed 9 years ago

0x-r4bbit commented 9 years ago

Clog creates and writes markdown files by default. I think there are also use cases, where don't want markdown as output, but rather JSON. It'd be cool if we could plug in any writer, as long as it implements a certain interface. The writer could then be configurable through .clog.toml and cli options.

LogWriter would then just be another writer that can be plugged into clog.

@kbknapp @cburgdorf wdyt?

kbknapp commented 9 years ago

This would be nice, and we could use another field in the .clog.toml to specify this. We could also add a -F, --format <format> to CLI options. Why types of formatters are you thinking, markdown, json, html?

0x-r4bbit commented 9 years ago

@kbknapp Currently I was mainly thinking about the json format, since @cburgdorf builds the web interface demo, which however, currently gets markdown from the server and therefore has to be post processed on the client.

It'd be much better if the server would just return JSON, so we are free in what we're doing with the data in the frontend.

In the end I can think of any format that people come up with.

vyp commented 9 years ago

I guess this might be a good time to plug in my idea of supporting the gnu changelog convention. Not because I actually use it, but because @cburgdorf appeared pretty liberal to how restrictive, or "philosophy orientated" clog should be. That is to say that he seems to allow whatever users may want, and not necessarily having to strictly conform to things (e.g. allow the feat: to ft: abbreviations). (Of course, if I misunderstood, just say so.)

Now the gnu changelog format (if you could call it that) isn't exactly the same as what we have here, and I know http://keepachangelog.com/ says it's naive or whatever, but I feel the idioms are similar enough that there's at least some common logic in there somewhere.

To be clear, this isn't a feature request or anything (I don't care much about it, never going to use it), I was actually going to attempt this myself whenever I felt like it. But it's just to say that having an internal ast makes it easier to possibly even have people make their own writers for whatever output format they're interested in! (And their writers don't necessarily have to be in the clog codebase itself, as long as the ast api is kept the same, or the changes to it are documented)


OR, with #58, you could even have people outputting json to stdout to whatever program that they write, which can be whatever language or anything, and that program could take the json and do whatever it likes with it to output to whatever format it wants. Essentially clog becoming the "unix" library to read and process 'conventional' git commit messages.

0x-r4bbit commented 9 years ago

@vyp Love that. I agree that clog should be able to consume any kind of commit message convention. I'll open another issue on that topic!

0x-r4bbit commented 9 years ago

The issue can be found here