github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/fs/operations/operationsflags/operationsflags.go (about)

     1  // Package operationsflags defines the flags used by rclone operations.
     2  // It is decoupled into a separate package so it can be replaced.
     3  package operationsflags
     4  
     5  import (
     6  	"github.com/rclone/rclone/fs/config/flags"
     7  	"github.com/rclone/rclone/fs/hash"
     8  	"github.com/rclone/rclone/fs/operations"
     9  	"github.com/spf13/pflag"
    10  )
    11  
    12  // AddLoggerFlagsOptions contains options for the Logger Flags
    13  type AddLoggerFlagsOptions struct {
    14  	Combined     string // a file with file names with leading sigils
    15  	MissingOnSrc string // files only in the destination
    16  	MissingOnDst string // files only in the source
    17  	Match        string // matching files
    18  	Differ       string // differing files
    19  	ErrFile      string // files with errors of some kind
    20  	DestAfter    string // files that exist on the destination post-sync
    21  }
    22  
    23  // AddLoggerFlags adds the logger flags to the cmdFlags command
    24  func AddLoggerFlags(cmdFlags *pflag.FlagSet, opt *operations.LoggerOpt, flagsOpt *AddLoggerFlagsOptions) {
    25  	flags.StringVarP(cmdFlags, &flagsOpt.Combined, "combined", "", flagsOpt.Combined, "Make a combined report of changes to this file", "Sync")
    26  	flags.StringVarP(cmdFlags, &flagsOpt.MissingOnSrc, "missing-on-src", "", flagsOpt.MissingOnSrc, "Report all files missing from the source to this file", "Sync")
    27  	flags.StringVarP(cmdFlags, &flagsOpt.MissingOnDst, "missing-on-dst", "", flagsOpt.MissingOnDst, "Report all files missing from the destination to this file", "Sync")
    28  	flags.StringVarP(cmdFlags, &flagsOpt.Match, "match", "", flagsOpt.Match, "Report all matching files to this file", "Sync")
    29  	flags.StringVarP(cmdFlags, &flagsOpt.Differ, "differ", "", flagsOpt.Differ, "Report all non-matching files to this file", "Sync")
    30  	flags.StringVarP(cmdFlags, &flagsOpt.ErrFile, "error", "", flagsOpt.ErrFile, "Report all files with errors (hashing or reading) to this file", "Sync")
    31  	flags.StringVarP(cmdFlags, &flagsOpt.DestAfter, "dest-after", "", flagsOpt.DestAfter, "Report all files that exist on the dest post-sync", "Sync")
    32  
    33  	// lsf flags for destAfter
    34  	flags.StringVarP(cmdFlags, &opt.Format, "format", "F", "p", "Output format - see lsf help for details", "Sync")
    35  	flags.StringVarP(cmdFlags, &opt.TimeFormat, "timeformat", "t", "", "Specify a custom time format, or 'max' for max precision supported by remote (default: 2006-01-02 15:04:05)", "")
    36  	flags.StringVarP(cmdFlags, &opt.Separator, "separator", "s", ";", "Separator for the items in the format", "Sync")
    37  	flags.BoolVarP(cmdFlags, &opt.DirSlash, "dir-slash", "d", true, "Append a slash to directory names", "Sync")
    38  	opt.HashType = hash.MD5
    39  	flags.FVarP(cmdFlags, &opt.HashType, "hash", "", "Use this hash when `h` is used in the format MD5|SHA-1|DropboxHash", "Sync")
    40  	flags.BoolVarP(cmdFlags, &opt.FilesOnly, "files-only", "", true, "Only list files", "Sync")
    41  	flags.BoolVarP(cmdFlags, &opt.DirsOnly, "dirs-only", "", false, "Only list directories", "Sync")
    42  	flags.BoolVarP(cmdFlags, &opt.Csv, "csv", "", false, "Output in CSV format", "Sync")
    43  	flags.BoolVarP(cmdFlags, &opt.Absolute, "absolute", "", false, "Put a leading / in front of path names", "Sync")
    44  	// flags.BoolVarP(cmdFlags, &recurse, "recursive", "R", false, "Recurse into the listing", "")
    45  }