Пример #1
0
Файл: cli.go Проект: Byron/godi
// return subcommands for our particular area of algorithms
func SubCommands() []gcli.Command {
	out := make([]gcli.Command, 1)
	cmd := verify.Command{}

	verify := gcli.Command{
		Name:      verify.Name,
		ShortName: "",
		Usage:     verifyDescription,
		Action:    func(c *gcli.Context) { cli.RunAction(&cmd, c) },
		Before:    func(c *gcli.Context) error { return cli.CheckCommonFlagsAndInit(&cmd, c) },
	}

	out[0] = verify
	return out
}
Пример #2
0
Файл: cli.go Проект: Byron/godi
func checkSeal(cmd *seal.Command, c *gcli.Context) error {
	cmd.Format = c.String(formatFlag)
	if len(cmd.Format) > 0 {
		valid := false
		for _, name := range codec.Names() {
			if name == cmd.Format {
				valid = true
				break
			}
		}
		if !valid {
			return fmt.Errorf("Invalid seal format '%s', must be one of %s", cmd.Format, strings.Join(codec.Names(), ", "))
		}
	}

	if err := cli.CheckCommonFlagsAndInit(cmd, c); err != nil {
		return err
	}

	return nil
}