OSDN Git Service
(root)
/
bytom
/
bytom-spv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
618c0f2
)
Add bytomd init command info prompt
author
Yahtoo Ma
<yahtoo.ma@gmail.com>
Thu, 19 Apr 2018 06:14:18 +0000
(14:14 +0800)
committer
Yahtoo Ma
<yahtoo.ma@gmail.com>
Thu, 19 Apr 2018 06:17:19 +0000
(14:17 +0800)
cmd/bytomd/commands/init.go
patch
|
blob
|
history
diff --git
a/cmd/bytomd/commands/init.go
b/cmd/bytomd/commands/init.go
index
15baa35
..
f19328a
100644
(file)
--- a/
cmd/bytomd/commands/init.go
+++ b/
cmd/bytomd/commands/init.go
@@
-1,6
+1,10
@@
package commands
import (
package commands
import (
+ "os"
+ "path"
+
+ log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
cfg "github.com/bytom/config"
"github.com/spf13/cobra"
cfg "github.com/bytom/config"
@@
-19,9
+23,18
@@
func init() {
}
func initFiles(cmd *cobra.Command, args []string) {
}
func initFiles(cmd *cobra.Command, args []string) {
+ configFilePath := path.Join(config.RootDir, "config.toml")
+ if _, err := os.Stat(configFilePath); !os.IsNotExist(err) {
+ log.WithField("config", configFilePath).Info("Already exists config file.")
+ return
+ }
+
if config.ChainID == "mainnet" {
cfg.EnsureRoot(config.RootDir, "mainnet")
} else {
cfg.EnsureRoot(config.RootDir, "testnet")
}
if config.ChainID == "mainnet" {
cfg.EnsureRoot(config.RootDir, "mainnet")
} else {
cfg.EnsureRoot(config.RootDir, "testnet")
}
+
+ log.WithField("config", configFilePath).Info("Initialized bytom")
+
}
}