Reimplement
This commit is contained in:
1 parent
d4d7c679aa
commit
df259e3f78
36 files changed
+559
-1135
No files matched your search
@@ -2,37 +2,27 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/urfave/cli/v2"
|
||||
"isp-ctl/command"
|
||||
"isp-ctl/flag"
|
||||
"isp-ctl/service"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/command"
|
||||
"ispctl/flag"
|
||||
)
|
||||
|
||||
var version = "1.1.0"
|
||||
|
||||
func main() {
|
||||
defineConfigurationPath()
|
||||
initCommands()
|
||||
}
|
||||
|
||||
func initCommands() {
|
||||
app := cli.NewApp()
|
||||
app.Usage = "isp configurations updater"
|
||||
app.UsageText =
|
||||
` ispctl [flag...] status
|
||||
ispctl [flag...] get module_name property_path
|
||||
ispctl [flag...] set module_name property_path [new_object]
|
||||
ispctl [flag...] delete module_name property_path
|
||||
ispctl [flag...] schema module_name [local_flag]
|
||||
ispctl [flag...] common `
|
||||
|
||||
app.Version = version
|
||||
app.Flags = []cli.Flag{
|
||||
flag.Host,
|
||||
flag.Uuid,
|
||||
flag.Color,
|
||||
flag.Unsafe,
|
||||
}
|
||||
app.EnableBashCompletion = true
|
||||
@@ -43,6 +33,8 @@ func initCommands() {
|
||||
command.Delete(),
|
||||
command.Schema(),
|
||||
command.CommonConfig(),
|
||||
command.Merge(),
|
||||
command.GitGet(),
|
||||
}
|
||||
app.BashComplete = func(context *cli.Context) {
|
||||
for _, appCommand := range app.Commands {
|
||||
@@ -55,11 +47,3 @@ func initCommands() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func defineConfigurationPath() {
|
||||
if os.Getenv("APP_MODE") == "dev" {
|
||||
service.SetConfigurationPath("./conf/config.yml")
|
||||
} else {
|
||||
service.SetConfigurationPath("/etc/ispctl/config.yml")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user