Example #1
0
File: cli.go Project: 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
}
Example #2
0
File: cli.go Project: Byron/godi
	To help protecting your valuable data effectively, you should have at least two 
	copies around in case one of thm gets corrupted. This sub-command
	does just that, and copies the data to one or more destinations while it is being sealed.

	[arguments ...] specify the source file(s) or directories, as well as the destination(s), for example
	godi sealed-copy s/ /Volumes/a
	godi sealed-copy s1/ s2/ -- /Volumes/a /Volumes/b`
)

var (
	formatDescription = fmt.Sprintf(`The format of the produced seal file, one of %s
	%s: is a compressed binary seal format, which is temper-proof and highly efficient, 
	handling millions of files easily.
	%s: is a human-readable XML format understood by mediahashlist.org, which will 
	be inefficient for large amount of files`,
		strings.Join(codec.Names(), ", "), codec.GobName, codec.MHLName)
)

// return subcommands for our particular area of algorithms
func SubCommands() []gcli.Command {
	cmdseal := seal.Command{Mode: seal.ModeSeal}
	cmdcopy := seal.Command{Mode: seal.ModeCopy}

	fmt := gcli.StringFlag{
		Name:  formatFlag,
		Value: codec.GobName,
		Usage: formatDescription,
	}

	return []gcli.Command{
		gcli.Command{