mirror of
https://github.com/thegeeklab/url-parser.git
synced 2024-11-16 10:10:41 +00:00
21 lines
291 B
Go
21 lines
291 B
Go
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
|
|
}
|