copy from github.com/koron/gomigemo/cmd/migemograp/main.go