func restoreBackup(c *cli.Context) error { url := c.GlobalString("url") task := sync.NewTask(url) backup := c.Args().First() if backup == "" { return fmt.Errorf("Missing required parameter backup") } if err := task.RestoreBackup(backup); err != nil { return err } return nil }
func rmSnapshot(c *cli.Context) error { var lastErr error url := c.GlobalString("url") task := sync.NewTask(url) for _, name := range c.Args() { if err := task.DeleteSnapshot(name); err == nil { fmt.Printf("deleted %s\n", name) } else { lastErr = err fmt.Fprintf(os.Stderr, "Failed to delete %s: %v\n", name, err) } } return lastErr }
func inspectBackup(c *cli.Context) error { url := c.GlobalString("url") task := sync.NewTask(url) backup := c.Args().First() if backup == "" { return fmt.Errorf("Missing required parameter backup") } output, err := task.InspectBackup(backup) if err != nil { return err } fmt.Println(output) return nil }
func createBackup(c *cli.Context) error { url := c.GlobalString("url") task := sync.NewTask(url) dest := c.String("dest") if dest == "" { return fmt.Errorf("Missing required parameter --dest") } snapshot := c.Args().First() if snapshot == "" { return fmt.Errorf("Missing required parameter snapshot") } backup, err := task.CreateBackup(snapshot, dest) if err != nil { return err } fmt.Println(backup) return nil }