mirror of
https://github.com/chubin/wttr.in
synced 2025-01-26 02:34:59 +00:00
Add CLI parsing
This commit is contained in:
parent
fb8f0d248b
commit
2328b29bfe
3 changed files with 16 additions and 0 deletions
2
go.mod
2
go.mod
|
@ -3,6 +3,8 @@ module github.com/chubin/wttr.in
|
|||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/alecthomas/kong v0.7.1 // indirect
|
||||
github.com/hashicorp/golang-lru v0.6.0
|
||||
github.com/robfig/cron v1.2.0
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
5
go.sum
5
go.sum
|
@ -1,4 +1,9 @@
|
|||
github.com/alecthomas/assert/v2 v2.1.0/go.mod h1:b/+1DI2Q6NckYi+3mXyH3wFb8qG37K/DuK80n7WefXA=
|
||||
github.com/alecthomas/kong v0.7.1 h1:azoTh0IOfwlAX3qN9sHWTxACE2oV8Bg2gAwBsMwDQY4=
|
||||
github.com/alecthomas/kong v0.7.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U=
|
||||
github.com/alecthomas/repr v0.1.0/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
|
||||
github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4=
|
||||
github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
|
||||
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
|
||||
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
||||
|
|
9
srv.go
9
srv.go
|
@ -2,17 +2,26 @@ package main
|
|||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/kong"
|
||||
|
||||
"github.com/chubin/wttr.in/internal/config"
|
||||
"github.com/chubin/wttr.in/internal/logging"
|
||||
"github.com/chubin/wttr.in/internal/processor"
|
||||
)
|
||||
|
||||
var cli struct {
|
||||
ConfigCheck bool `name:"config-check" help:"Check configuration"`
|
||||
ConfigDump bool `name:"config-dump" help:"Dump configuration"`
|
||||
ConfigFile string `name:"config-file" arg:"" optional:"" help:"Name of configuration file"`
|
||||
}
|
||||
|
||||
const logLineStart = "LOG_LINE_START "
|
||||
|
||||
func copyHeader(dst, src http.Header) {
|
||||
|
|
Loading…
Reference in a new issue