fix(bash complete)
This commit is contained in:
1 parent
6155ebf062
commit
d1558438cf
18 files changed
+305
-261
No files matched your search
+14
-9
@@ -3,6 +3,9 @@ package command
|
||||
import (
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/tidwall/sjson"
|
||||
"isp-ctl/bash"
|
||||
"isp-ctl/flag"
|
||||
"isp-ctl/service"
|
||||
)
|
||||
|
||||
func Delete() cli.Command {
|
||||
@@ -10,7 +13,7 @@ func Delete() cli.Command {
|
||||
Name: "delete",
|
||||
Usage: "delete configuration by module_name",
|
||||
Action: deleteComm.action,
|
||||
BashComplete: bash.run,
|
||||
BashComplete: bash.ModuleNameAndConfigurationPath.Complete,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,21 +21,23 @@ var deleteComm deleteCommand
|
||||
|
||||
type deleteCommand struct{}
|
||||
|
||||
func (d deleteCommand) action(c *cli.Context) {
|
||||
if err := checkFlags(c); err != nil {
|
||||
func (d deleteCommand) action(ctx *cli.Context) {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
printError(err)
|
||||
return
|
||||
}
|
||||
moduleName := c.Args().First()
|
||||
pathObject := c.Args().Get(1)
|
||||
moduleName := ctx.Args().First()
|
||||
pathObject := ctx.Args().Get(1)
|
||||
|
||||
moduleConfiguration, jsonObject := getModuleConfiguration(moduleName)
|
||||
if moduleConfiguration == nil {
|
||||
moduleConfiguration, jsonObject, err := service.Config.GetConfigurationAndJsonByModuleName(moduleName)
|
||||
if err != nil {
|
||||
printError(err)
|
||||
return
|
||||
}
|
||||
|
||||
pathObject, ok := checkPath(pathObject)
|
||||
if !ok {
|
||||
pathObject, err = checkPath(pathObject)
|
||||
if err != nil {
|
||||
printError(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user