version flag
ci/woodpecker/tag/goreleaser Pipeline was successful
Details
ci/woodpecker/tag/goreleaser Pipeline was successful
Details
Signed-off-by: jolheiser <john.olheiser@gmail.com>main v0.0.1
parent
a54e766bd3
commit
b30e898d82
16
main.go
16
main.go
|
@ -1,6 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
|
||||
"github.com/caarlos0/log"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
@ -8,6 +11,19 @@ import (
|
|||
var Version = "develop"
|
||||
|
||||
func main() {
|
||||
fs := flag.NewFlagSet("trending", flag.ExitOnError)
|
||||
versionFlag := fs.Bool("version", false, "Show version and exit")
|
||||
fs.BoolVar(versionFlag, "v", *versionFlag, "--version")
|
||||
if err := fs.Parse(os.Args[1:]); err != nil {
|
||||
log.WithError(err).Error("")
|
||||
return
|
||||
}
|
||||
|
||||
if *versionFlag {
|
||||
log.Infof("trending (%s)", Version)
|
||||
return
|
||||
}
|
||||
|
||||
cfg, err := loadConfig()
|
||||
if err != nil {
|
||||
log.WithError(err).Error("could not load config")
|
||||
|
|
Loading…
Reference in New Issue