luckyframework/lucky

Add format flag to `lucky routes` for outputting alternate formats

jwoertink opened this issue · 2 comments

We currently have some nice output when you run lucky routes

image

I've been working with front end APIs a lot lately, and just had the idea of what if you could do something like lucky routes --format=json then have a json file that maps all of these routes. Drop that file in to your SPA and somehow hook it up in a way that if a route changes on the backend, it would be updated on the frontend.

The use case could be for whatever really, but just having an alternate format option might be nice.

Hi,
I would like to take care of this issue.

Does the JSON output need to be noise-free in order to be output to a file? (ex: lucky routes --format=json > routes.json)

I can also provide a --quiet argument for noise-free output and leave the "banner message" when the argument is not present.

I can also add a --output argument to write directly to a file.

What is your opinion?

That would be great! My original thought was that it would just push to stdout like it does now, and you could redirect that to a file however you need

lucky routes --format=json 2> routes.json

I guess a few extra flags for output wouldn't be too bad just to make sure it's also windows compatible.