7 "github.com/spf13/cobra"
8 "github.com/spf13/viper"
9 cmn "github.com/tendermint/tmlibs/common"
11 cfg "github.com/vapor/config"
15 config = cfg.DefaultConfig()
18 var RootCmd = &cobra.Command{
20 Short: "Multiple asset management.",
21 PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
22 err := viper.Unmarshal(config)
26 pathParts := strings.SplitN(config.RootDir, "/", 2)
27 if len(pathParts) == 2 && (pathParts[0] == "~" || pathParts[0] == "$HOME") {
28 usr, err := user.Current()
30 cmn.Exit("Error: " + err.Error())
32 pathParts[0] = usr.HomeDir
33 config.RootDir = strings.Join(pathParts, "/")
35 config.SetRoot(config.RootDir)