url-parser/commands/commands.go

21 lines
291 B
Go
Raw Normal View History

2020-02-02 23:05:18 +00:00
package commands
import (
"net/url"
"strings"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
func parseURL(c *cli.Context) *url.URL {
urlString := strings.TrimSpace(c.String("url"))
url, err := url.Parse(urlString)
if err != nil {
logrus.Fatal(err)
}
return url
}