Add an --out option. And by default, console.log out the swagger file.
gkoberger opened this issue ยท 6 comments
Problem: I keep using swagger.json
as my base, and I keep mistakenly overwriting it.
Solution: By default, let's make it just console.log
out the Swagger result. Let's also add an --out
option for choosing a place to write it to. If the --out
value ends with .json
, write it as JSON. If it's .yaml
, write it as YAML.
Bonus Points: Maybe we can also add a --format
option that lets you choose the format (so you can use .yaml
as the --base
, but output it as JSON). It'll also let you be specific if your --out
file doesn't have a proper extension.
Going to make it so that when you include --out
it logs the feedback (eg. "Why do you have 15 swagger.json files?"). If you don't include that, the only thing logged is the result. Then you can pipe the results to other crazy unix commands :).
That sounds great!
Added!
Changes:
--out
is now the final say on the output filetype- Including
--out
for the Cli or the module will cause the file to be written to the provided path. - Including
--out
will cause the Cli to log progress messages and such. - Omitting
--out
will disable all logging. The output will either be the finalswagger
or an error message if things really blow up.
(And I was overly excited and made all the changes on master! New branch for future features ๐ )
Re-open if it gives you problems, otherwise closing this downnn ๐
This looks great! :)