version flag
ci/woodpecker/tag/goreleaser Pipeline was successful Details

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main v0.0.1
jolheiser 2022-10-25 11:40:11 -05:00
parent a54e766bd3
commit b30e898d82
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
1 changed files with 16 additions and 0 deletions

16
main.go
View File

@ -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")