mirror of
https://github.com/thegeeklab/url-parser.git
synced 2024-11-18 03:00:43 +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
|
|
}
|