cmd

package
Version: v0.0.0-...-ccc3cc6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2021 License: LGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigDir is the directory to store config file
	ConfigDir string
	// DefaultConfigFile is the default config file name
	DefaultConfigFile string
)

Directories

View Source
var (
	// ErrConfigNotMatch indicates error for no config matchs
	ErrConfigNotMatch = "no config matchs"
	// ErrEmptyEndpoint indicates error for empty endpoint
	ErrEmptyEndpoint = "no endpoint has been set"
)

Error strings

View Source
var (

	// RootCmd is single entry point of the CLI
	RootCmd = &cobra.Command{
		Use:          "tronctl",
		Short:        "Tron Blokchain Controller ",
		SilenceUsage: true,
		PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
			if verbose {
				common.EnableAllVerbose()
			}
			switch URLcomponents := strings.Split(node, ":"); len(URLcomponents) {
			case 1:
				node = node + ":50051"
			}
			conn = client.NewGrpcClient(node)
			if err := conn.Start(); err != nil {
				return err
			}

			if len(signer) > 0 {
				var err error
				if signerAddress, err = findAddress(signer); err != nil {
					return err
				}
			}

			var err error
			passphrase, err = getPassphrase()
			if err != nil {
				return err
			}

			if len(defaultKeystoreDir) > 0 {

				store.SetDefaultLocation(defaultKeystoreDir)
			}

			return nil
		},
		Long: fmt.Sprintf(`
CLI interface to Tron blockchain

%s`, g("type 'tronclt --help' for details")),
		RunE: func(cmd *cobra.Command, args []string) error {
			cmd.Help()
			return nil
		},
	}
)
View Source
var (
	// VersionWrapDump meant to be set from main.go
	VersionWrapDump = ""
)

Functions

func Execute

func Execute()

Execute kicks off the tronctl CLI

func SaveConfig

func SaveConfig(conf *Config) error

SaveConfig to yaml

Types

type Config

type Config struct {
	Node     string `yaml:"node"`
	Ledger   bool   `yaml:"ledger"`
	Verbose  bool   `yaml:"verbose"`
	Timeout  uint32 `yaml:"timeout"`
	NoPretty bool   `yaml:"noPretty"`
}

Config defines the config schema

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads config file in yaml format

type GitHubRelease

type GitHubRelease struct {
	Prerelease      bool                  `json:"prerelease"`
	TagName         string                `json:"tag_name"`
	TargetCommitish string                `json:"target_commitish"`
	CreatedAt       time.Time             `json:"created_at"`
	Assets          []GitHubReleaseAssets `json:"assets"`
}

GitHubRelease json struct

type GitHubReleaseAssets

type GitHubReleaseAssets struct {
	ID   json.Number `json:"id"`
	Name string      `json:"name"`
	Size json.Number `json:"size"`
	URL  string      `json:"browser_download_url"`
}

GitHubReleaseAssets json struct

type GitHubTag

type GitHubTag struct {
	Ref    string `json:"ref"`
	NodeID string `json:"node_id"`
	URL    string `json:"url"`
	DATA   struct {
		SHA string `json:"sha"`
	} `json:"object"`
}

GitHubTag json struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL