本文整理匯總了Golang中github.com/eris-ltd/eris-cli/Godeps/_workspace/src/github.com/spf13/cobra.Command.Help方法的典型用法代碼示例。如果您正苦於以下問題:Golang Command.Help方法的具體用法?Golang Command.Help怎麽用?Golang Command.Help使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/eris-ltd/eris-cli/Godeps/_workspace/src/github.com/spf13/cobra.Command
的用法示例。
在下文中一共展示了Command.Help方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ListIt
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: FilesCat
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: PinIt
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: FlagCheck
//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: MakeChain
// 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))
}