github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/vfs/vfsflags/vfsflags.go (about)

     1  // Package vfsflags implements command line flags to set up a vfs
     2  package vfsflags
     3  
     4  import (
     5  	"github.com/rclone/rclone/fs/config/flags"
     6  	"github.com/rclone/rclone/fs/rc"
     7  	"github.com/rclone/rclone/vfs"
     8  	"github.com/spf13/pflag"
     9  )
    10  
    11  // Options set by command line flags
    12  var (
    13  	Opt       = vfs.DefaultOpt
    14  	DirPerms  = &FileMode{Mode: &Opt.DirPerms}
    15  	FilePerms = &FileMode{Mode: &Opt.FilePerms}
    16  )
    17  
    18  // AddFlags adds the non filing system specific flags to the command
    19  func AddFlags(flagSet *pflag.FlagSet) {
    20  	rc.AddOption("vfs", &Opt)
    21  	flags.BoolVarP(flagSet, &Opt.NoModTime, "no-modtime", "", Opt.NoModTime, "Don't read/write the modification time (can speed things up).")
    22  	flags.BoolVarP(flagSet, &Opt.NoChecksum, "no-checksum", "", Opt.NoChecksum, "Don't compare checksums on up/download.")
    23  	flags.BoolVarP(flagSet, &Opt.NoSeek, "no-seek", "", Opt.NoSeek, "Don't allow seeking in files.")
    24  	flags.DurationVarP(flagSet, &Opt.DirCacheTime, "dir-cache-time", "", Opt.DirCacheTime, "Time to cache directory entries for.")
    25  	flags.DurationVarP(flagSet, &Opt.PollInterval, "poll-interval", "", Opt.PollInterval, "Time to wait between polling for changes. Must be smaller than dir-cache-time. Only on supported remotes. Set to 0 to disable.")
    26  	flags.BoolVarP(flagSet, &Opt.ReadOnly, "read-only", "", Opt.ReadOnly, "Mount read-only.")
    27  	flags.FVarP(flagSet, &Opt.CacheMode, "vfs-cache-mode", "", "Cache mode off|minimal|writes|full")
    28  	flags.DurationVarP(flagSet, &Opt.CachePollInterval, "vfs-cache-poll-interval", "", Opt.CachePollInterval, "Interval to poll the cache for stale objects.")
    29  	flags.DurationVarP(flagSet, &Opt.CacheMaxAge, "vfs-cache-max-age", "", Opt.CacheMaxAge, "Max age of objects in the cache.")
    30  	flags.FVarP(flagSet, &Opt.CacheMaxSize, "vfs-cache-max-size", "", "Max total size of objects in the cache.")
    31  	flags.FVarP(flagSet, &Opt.ChunkSize, "vfs-read-chunk-size", "", "Read the source objects in chunks.")
    32  	flags.FVarP(flagSet, &Opt.ChunkSizeLimit, "vfs-read-chunk-size-limit", "", "If greater than --vfs-read-chunk-size, double the chunk size after each chunk read, until the limit is reached. 'off' is unlimited.")
    33  	flags.FVarP(flagSet, DirPerms, "dir-perms", "", "Directory permissions")
    34  	flags.FVarP(flagSet, FilePerms, "file-perms", "", "File permissions")
    35  	flags.BoolVarP(flagSet, &Opt.CaseInsensitive, "vfs-case-insensitive", "", Opt.CaseInsensitive, "If a file name not found, find a case insensitive match.")
    36  	platformFlags(flagSet)
    37  }