package main


import (
        "os"
        "fmt"
        "net/http"
        "io/ioutil"
        "github.com/ghodss/yaml"
)

func main() {
        argsWithoutProg := os.Args[1:]
        for _, element := range argsWithoutProg {
                resp, err := http.Get(element)
                if err != nil {
                        fmt.Printf("err: %v\n", err)
                        return
                }
                defer resp.Body.Close()
                body, err := ioutil.ReadAll(resp.Body)
                if err != nil {
                        fmt.Printf("err: %v\n", err)
                } else {
                        // fmt.Println(string(body))
                        y, err := yaml.JSONToYAML(body)
                        if err != nil {
                                fmt.Printf("err: %v\n", err)
                                return
                        }
                        fmt.Println(string(y))
                }
        }
}
