-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6026190
commit 6ffc1c8
Showing
5 changed files
with
177 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package commands | |
import ( | ||
"flag" | ||
"fmt" | ||
"github.com/tenderly/tenderly-cli/userError" | ||
"os" | ||
|
||
"github.com/sirupsen/logrus" | ||
|
@@ -34,20 +35,29 @@ func init() { | |
|
||
func Execute() { | ||
if err := rootCmd.Execute(); err != nil { | ||
//@TODO: Print some common failure text here. | ||
logrus.Errorf("Command failed with error: %s", err) | ||
initLog() | ||
userError.LogErrorf("command failed with error: %s", userError.NewUserError( | ||
err, | ||
"Command failed", | ||
)) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "tenderly", | ||
Short: "Tenderly CLI is a suite of development tools for smart contracts.", | ||
Long: "Tenderly CLI is a suite of development tools for smart contracts which allows your to monitor and debugMode them on any network.\n\n" + | ||
Long: "Tenderly CLI is a suite of development tools for smart contracts which allows your to monitor and debug them on any network.\n\n" + | ||
"To report a bug or give feedback send us an email at [email protected] or join our Discord channel at https://discord.gg/eCWjuvt\n", | ||
} | ||
|
||
func initConfig() { | ||
initLog() | ||
|
||
config.Init() | ||
} | ||
|
||
func initLog() { | ||
logrus.SetFormatter(&logrus.TextFormatter{ | ||
DisableLevelTruncation: true, | ||
}) | ||
|
@@ -58,8 +68,6 @@ func initConfig() { | |
logrus.SetLevel(logrus.DebugLevel) | ||
logrus.SetReportCaller(true) | ||
} | ||
|
||
config.Init() | ||
} | ||
|
||
func printHelp() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters