Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "flag"
- "io/ioutil"
- )
- type cliFlags struct {
- fileIn string
- fileOut string
- }
- func main() {
- cf := new(cliFlags)
- flag.StringVar(&cf.fileIn, "in", "openapi.json", "name of the openapi json file")
- flag.StringVar(&cf.fileOut, "out", "openapi.md", "name of the output markdown file")
- flag.Parse()
- dataIn, err := ioutil.ReadFile(cf.fileIn)
- if err != nil {
- panic(err)
- }
- replaceRefs(string(dataIn))
- oa, err := read(dataIn)
- if err != nil {
- panic(err)
- }
- md, err := write(oa)
- if err != nil {
- panic(err)
- }
- err = ioutil.WriteFile(cf.fileOut, []byte(md), 0644)
- if err != nil {
- panic(err)
- }
- }
Add Comment
Please, Sign In to add comment