mirror of
https://github.com/taigrr/go-selfupdate
synced 2025-01-18 04:33:12 -08:00
refactor
This commit is contained in:
parent
15d118d3bd
commit
210eb0dbd0
31
main.go
31
main.go
@ -124,31 +124,36 @@ func createUpdate(path string, platform string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func printUsage() {
|
func printUsage() {
|
||||||
fmt.Println("Go-Selfupdate - Enable your Golang applications to self update.\n\n")
|
fmt.Println("Go-Selfupdate - Enable your Golang applications to self update.\n\n")
|
||||||
fmt.Println("Usage:\n")
|
fmt.Println("Usage:\n")
|
||||||
fmt.Println("\tSingle platform: go-selfupdate myapp 1.2")
|
fmt.Println("\tSingle platform: go-selfupdate myapp 1.2")
|
||||||
fmt.Println("\tCross platform: go-selfupdate /tmp/mybinares/ 1.2")
|
fmt.Println("\tCross platform: go-selfupdate /tmp/mybinares/ 1.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
func isArgsPresent() bool {
|
func isArgsPresent() bool {
|
||||||
if len(os.Args) < 2 {
|
if len(os.Args) < 2 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func createBuildDir() {
|
||||||
|
os.MkdirAll(genDir, 0755)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if isArgsPresent() == false {
|
if isArgsPresent() == false {
|
||||||
printUsage()
|
printUsage()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
plat = os.Getenv("GOOS") + "-" + os.Getenv("GOARCH")
|
plat = os.Getenv("GOOS") + "-" + os.Getenv("GOARCH")
|
||||||
appPath = os.Args[1]
|
appPath = os.Args[1]
|
||||||
version = os.Args[2]
|
version = os.Args[2]
|
||||||
genDir = "public"
|
genDir = "public"
|
||||||
os.MkdirAll(genDir, 0755)
|
|
||||||
|
createBuildDir()
|
||||||
|
|
||||||
// If dir is given create update for each file
|
// If dir is given create update for each file
|
||||||
files, err := ioutil.ReadDir(appPath)
|
files, err := ioutil.ReadDir(appPath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user