mirror of https://github.com/curusarn/resh
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
919 B
49 lines
919 B
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// info passed during build
|
|
var version string
|
|
var commit string
|
|
var developement bool
|
|
|
|
func main() {
|
|
var command string
|
|
flag.StringVar(&command, "command", "", "Utility to run")
|
|
flag.Parse()
|
|
|
|
switch command {
|
|
case "backup":
|
|
backup()
|
|
case "rollback":
|
|
rollback()
|
|
case "migrate-config":
|
|
migrateConfig()
|
|
case "migrate-history":
|
|
migrateHistory()
|
|
case "help":
|
|
printUsage(os.Stdout)
|
|
default:
|
|
fmt.Fprintf(os.Stderr, "ERROR: Unknown command")
|
|
printUsage(os.Stderr)
|
|
}
|
|
}
|
|
|
|
func printUsage(f *os.File) {
|
|
usage := `
|
|
Utils used during resh instalation
|
|
|
|
USAGE: ./install-utils COMMAND
|
|
COMMANDS:
|
|
backup backup resh installation and data
|
|
rollback restore resh installation and data from backup
|
|
migrate-config update config to reflect updates
|
|
migrate-history update history to reflect updates
|
|
help show this help
|
|
`
|
|
fmt.Fprintf(f, usage)
|
|
}
|
|
|