Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: main function, full and light commands with subcommands #97

Merged
merged 15 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/celestia/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func run() error {
}

var rootCmd = &cobra.Command{
Use: "celestia [subcommand]",
Use: "celestia [ full || light ] [subcommand]",
Short: `
/ ____/__ / /__ _____/ /_(_)___ _
/ / / _ \/ / _ \/ ___/ __/ / __ /
Expand Down
6 changes: 3 additions & 3 deletions node/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func InitWith(path string, tp Type, cfg *Config) error {
return err
}
log.Infof("Initializing %s Node Repository over '%s'", tp, path)
defer log.Info("Node Repository initialized")

err = initRoot(path)
if err != nil {
Expand Down Expand Up @@ -55,9 +54,9 @@ func InitWith(path string, tp Type, cfg *Config) error {
if err != nil {
return err
}
log.Info("Saving config")
log.Infow("Saving config", "path", cfgPath)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@renaynay, What's the point of this log if it duplicates Initializing %s Node Repository over '%s' above? I mean it logs the path to the repo and cfg is constantly repo_path+config.toml, so not sure if there is a point to add this path here, but it does not hurt anyway.

} else {
log.Info("Config already exists")
log.Infow("Config already exists", "path", cfgPath)
}

// TODO(@Wondertan): This is a lazy hack which prevents Core Repository to be generated for all case, and generates
Expand All @@ -73,6 +72,7 @@ func InitWith(path string, tp Type, cfg *Config) error {
return core.Init(corePath)
}

log.Info("Node Repository initialized")
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (n *Node) Start(ctx context.Context) error {
err := n.app.Start(ctx)
if err != nil {
log.Errorf("starting %s Node: %s", n.Type, err)
return fmt.Errorf("node: faild to start: %w", err)
return fmt.Errorf("node: failed to start: %w", err)
}
log.Infof("started %s Node", n.Type)

Expand Down