本文整理汇总了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))
}