mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-10 01:18:30 +08:00
1d9d2b1a19
* starting to refactor commands * work * not sure * all commands working! * actually add file * work in delay flag again * start to refactor out console printing * i hate line endings * simple travis test to find direct output * remove all direct printing from push/preview * checkin vendor * don't need this yet * forgot to commit these * make version explicit command * some code review * Add "check" subcommand. * move stuff to commands package * fix * comment out check for printlns. for now * alphabet hax * activedir flags gone. use creds instead * active dir doc update * remove bind specific flags. creds instead * default to zones dir * fix linux build * fix test * cleanup random global* vars * Clean up PowerShell docs * rename dump-ir to print-ir. combine with print-js
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"strconv"
|
|
"time"
|
|
|
|
"github.com/StackExchange/dnscontrol/commands"
|
|
_ "github.com/StackExchange/dnscontrol/providers/_all"
|
|
)
|
|
|
|
//go:generate go run build/generate/generate.go
|
|
|
|
func main() {
|
|
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
|
commands.Run(versionString())
|
|
}
|
|
|
|
// Version management. 2 Goals:
|
|
// 1. Someone who just does "go get" has at least some information.
|
|
// 2. If built with build/build.go, more specific build information gets put in.
|
|
// Update the number here manually each release, so at least we have a range for go-get people.
|
|
var (
|
|
SHA = ""
|
|
Version = "0.2.0"
|
|
BuildTime = ""
|
|
)
|
|
|
|
// printVersion prints the version banner.
|
|
func versionString() string {
|
|
var version string
|
|
if SHA != "" {
|
|
version = fmt.Sprintf("%s (%s)", Version, SHA)
|
|
} else {
|
|
version = fmt.Sprintf("%s-dev", Version) //no SHA. '0.x.y-dev' indicates it is run fromm source without build script.
|
|
}
|
|
if BuildTime != "" {
|
|
i, err := strconv.ParseInt(BuildTime, 10, 64)
|
|
if err == nil {
|
|
tm := time.Unix(i, 0)
|
|
version += fmt.Sprintf(" built %s", tm.Format(time.RFC822))
|
|
}
|
|
}
|
|
return fmt.Sprintf("dnscontrol %s", version)
|
|
}
|