url-parser/cmd/url-parser/main.go

34 lines
631 B
Go
Raw Normal View History

2020-02-03 00:19:01 +01:00
package main
import (
"fmt"
2020-02-03 00:19:01 +01:00
"os"
"github.com/sirupsen/logrus"
2020-09-21 20:24:51 +02:00
"github.com/thegeeklab/url-parser/internal/command"
2020-02-03 00:19:01 +01:00
"github.com/urfave/cli/v2"
)
var (
BuildVersion = "devel"
BuildDate = "00000000"
)
2020-02-03 00:19:01 +01:00
func main() {
cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("%s version=%s date=%s\n", c.App.Name, c.App.Version, BuildDate)
}
2020-02-03 00:19:01 +01:00
app := cli.NewApp()
app.Name = "url-parser"
app.Usage = "Parse URL and shows the part of it."
app.Version = BuildVersion
2020-09-21 20:24:51 +02:00
app.Action = command.Run
2020-02-03 00:19:01 +01:00
app.Flags = globalFlags()
app.Commands = configCommands()
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}