add(new command schema)
This commit is contained in:
1 parent
fcafab05d1
commit
f32d9a80b0
16 files changed
+306
-77
No files matched your search
+4
-3
@@ -3,6 +3,7 @@ package command
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/tidwall/sjson"
|
||||
@@ -23,7 +24,7 @@ type setCommand struct{}
|
||||
|
||||
func (s setCommand) action(c *cli.Context) {
|
||||
if err := checkFlags(c); err != nil {
|
||||
fmt.Println(err)
|
||||
printError(err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -49,7 +50,7 @@ func (s setCommand) action(c *cli.Context) {
|
||||
}
|
||||
|
||||
if changeObject == "" {
|
||||
fmt.Println("Error. Expected argument")
|
||||
printError(errors.New("expected argument"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -59,7 +60,7 @@ func (s setCommand) action(c *cli.Context) {
|
||||
} else {
|
||||
changeArgument := s.parseObject(changeObject)
|
||||
if stringToChange, err := sjson.Set(string(jsonObject), pathObject, changeArgument); err != nil {
|
||||
fmt.Println(err)
|
||||
printError(err)
|
||||
return
|
||||
} else {
|
||||
createUpdateConfig(stringToChange, moduleConfiguration)
|
||||
|
||||
Reference in new issue
Block a user