2018-11-07 19:07:15 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"os/user"
|
|
|
|
|
2019-09-01 10:27:06 +00:00
|
|
|
"github.com/Masterminds/semver"
|
|
|
|
|
2019-06-15 13:58:41 +00:00
|
|
|
"github.com/go-flucky/flucky/cmd"
|
2018-11-07 19:07:15 +00:00
|
|
|
)
|
|
|
|
|
2019-09-01 10:27:06 +00:00
|
|
|
var (
|
|
|
|
version string
|
|
|
|
)
|
2018-11-07 19:07:15 +00:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
|
|
user, err := user.Current()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if user.Uid != "0" {
|
|
|
|
log.Println("you need to be root to run this command")
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
2019-09-01 10:27:06 +00:00
|
|
|
sversion, err := semver.NewVersion(version)
|
|
|
|
if err != nil {
|
2019-09-04 11:37:50 +00:00
|
|
|
log.Printf("The sematic versioning is invalid: %v", version)
|
2019-09-01 10:27:06 +00:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
2019-09-04 11:37:50 +00:00
|
|
|
cmd.Execute(sversion)
|
2018-11-07 19:07:15 +00:00
|
|
|
}
|