Added option to run local (rsync) or cloud (rclone) backups, in case you prefer a "full" copy with hardlinks via rsync, or latest/incremental snapshots via rclone
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var backupCmd = &cobra.Command{
|
||||
Use: "backup",
|
||||
Short: "Run an incremental backup job",
|
||||
Long: `Run incremental backups to cloud targets (via Rclone) or local targets (via Rsync).`,
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(backupCmd)
|
||||
|
||||
// Flags inherited by both 'cloud' and 'local' subcommands
|
||||
backupCmd.PersistentFlags().StringP("src", "s", "", "source directory")
|
||||
backupCmd.PersistentFlags().StringP("dst", "d", "", "destination directory")
|
||||
backupCmd.PersistentFlags().Int("keep", 14, "number of incremental versions to retain")
|
||||
|
||||
_ = viper.BindPFlag("source", backupCmd.PersistentFlags().Lookup("src"))
|
||||
_ = viper.BindPFlag("destination", backupCmd.PersistentFlags().Lookup("dst"))
|
||||
_ = viper.BindPFlag("keep_incrementals", backupCmd.PersistentFlags().Lookup("keep"))
|
||||
}
|
||||
Reference in New Issue
Block a user