github.com/10XDev/rclone@v1.52.3-0.20200626220027-16af9ab76b2a/cmd/sha1sum/sha1sum.go (about)

     1  package sha1sum
     2  
     3  import (
     4  	"context"
     5  	"os"
     6  
     7  	"github.com/rclone/rclone/cmd"
     8  	"github.com/rclone/rclone/fs/operations"
     9  	"github.com/spf13/cobra"
    10  )
    11  
    12  func init() {
    13  	cmd.Root.AddCommand(commandDefinition)
    14  }
    15  
    16  var commandDefinition = &cobra.Command{
    17  	Use:   "sha1sum remote:path",
    18  	Short: `Produces an sha1sum file for all the objects in the path.`,
    19  	Long: `
    20  Produces an sha1sum file for all the objects in the path.  This
    21  is in the same format as the standard sha1sum tool produces.
    22  `,
    23  	Run: func(command *cobra.Command, args []string) {
    24  		cmd.CheckArgs(1, 1, command, args)
    25  		fsrc := cmd.NewFsSrc(args)
    26  		cmd.Run(false, false, command, func() error {
    27  			return operations.Sha1sum(context.Background(), fsrc, os.Stdout)
    28  		})
    29  	},
    30  }