コード例 #1
0
ファイル: files.go プロジェクト: kustomzone/eris-cli
func ListIt(cmd *cobra.Command, args []string) {
	if len(args) != 1 {
		cmd.Help()
		return
	}
	do.Name = args[0]
	err := files.ListFiles(do)
	IfExit(err)
	logger.Println(do.Result)
}
コード例 #2
0
ファイル: files.go プロジェクト: mxjxn/eris-cli
func FilesCat(cmd *cobra.Command, args []string) {
	if len(args) != 1 {
		cmd.Help()
		return
	}
	do.Name = args[0]
	err := files.CatFiles(do)
	IfExit(err)
	log.Warn(do.Result)

}
コード例 #3
0
ファイル: files.go プロジェクト: kustomzone/eris-cli
func PinIt(cmd *cobra.Command, args []string) {
	if do.CSV == "" {
		if len(args) != 1 {
			cmd.Help()
			return
		}
		do.Name = args[0]
	} else {
		do.Name = ""
	}
	err := files.PinFiles(do)
	IfExit(err)
	logger.Println(do.Result)
}
コード例 #4
0
ファイル: eris.go プロジェクト: alexandrev/eris-cli
//restrict flag behaviour when needed (rare but used sometimes)
func FlagCheck(num int, comp string, cmd *cobra.Command, flags []string) error {
	switch comp {
	case "eq":
		if len(flags) != num {
			cmd.Help()
			return fmt.Errorf("\n**Note** you sent our marmots the wrong number of flags.\nPlease send the marmots %d flags only.", num)
		}
	case "ge":
		if len(flags) < num {
			cmd.Help()
			return fmt.Errorf("\n**Note** you sent our marmots the wrong number of flags.\nPlease send the marmots at least %d flag(s).", num)
		}
	}
	return nil
}
コード例 #5
0
ファイル: chains.go プロジェクト: antonylewis/eris-cli
// make the genesis files for a chain
//
// MakeChain will assemble the necessary files for a new blockchain. it does not
// actually make the chain or start it (that happens in new), but it does create
// the predicate files for more complex chains than is typically used in default
func MakeChain(cmd *cobra.Command, args []string) {
	IfExit(ArgCheck(1, "ge", cmd, args))
	do.Name = args[0]
	if do.Known && (do.ChainMakeActs == "" || do.ChainMakeVals == "") {
		cmd.Help()
		IfExit(fmt.Errorf("\nIf you are using the --known flag the --validators *and* the --accounts flags are both required."))
	}
	if len(do.AccountTypes) > 0 && do.ChainType != "" {
		cmd.Help()
		IfExit(fmt.Errorf("\nThe --account-types flag is incompatible with the --chain-type flag. Please use one or the other."))
	}
	if (len(do.AccountTypes) > 0 || do.ChainType != "") && do.Known {
		cmd.Help()
		IfExit(fmt.Errorf("\nThe --account-types and --chain-type flags are incompatible with the --known flag. Please use only one of these."))
	}
	IfExit(chns.MakeChain(do))
}