chore: initial commit

This commit is contained in:
2022-02-26 14:08:44 +00:00
commit b67da4accb
12 changed files with 1616 additions and 0 deletions

35
command_config.go Normal file
View File

@@ -0,0 +1,35 @@
package main
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
func configCommand() (*cobra.Command, error) {
cmd := &cobra.Command{
Use: "config",
Short: "Show evm environment/setup details.",
Aliases: []string{"env", "info"},
ValidArgs: []string{},
RunE: configRunE,
}
cmd.Flags().StringP("format", "f", "", "output format (yaml or json)")
err := viper.BindPFlag("info.format", cmd.Flags().Lookup("format"))
if err != nil {
return nil, err
}
return cmd, nil
}
func configRunE(cmd *cobra.Command, _ []string) error {
conf, err := getConfig()
if err != nil {
return err
}
format := viper.GetString("info.format")
return render(cmd.OutOrStdout(), format, conf)
}