diff --git a/cmd/authorize/authorize.go b/cmd/authorize/authorize.go index 9ad39d755..5661ad52e 100644 --- a/cmd/authorize/authorize.go +++ b/cmd/authorize/authorize.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(authorizeCmd) + cmd.Root.AddCommand(commandDefintion) } -var authorizeCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "authorize", Short: `Remote authorization.`, Long: ` diff --git a/cmd/cat/cat.go b/cmd/cat/cat.go index 2b8c7b625..5ae6b5928 100644 --- a/cmd/cat/cat.go +++ b/cmd/cat/cat.go @@ -9,10 +9,10 @@ import ( ) func init() { - cmd.Root.AddCommand(catCmd) + cmd.Root.AddCommand(commandDefintion) } -var catCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "cat remote:path", Short: `Concatenates any files and sends them to stdout.`, Long: ` diff --git a/cmd/check/check.go b/cmd/check/check.go index 7c0945301..9c116a09d 100644 --- a/cmd/check/check.go +++ b/cmd/check/check.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(checkCmd) + cmd.Root.AddCommand(commandDefintion) } -var checkCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "check source:path dest:path", Short: `Checks the files in the source and destination match.`, Long: ` diff --git a/cmd/cleanup/cleanup.go b/cmd/cleanup/cleanup.go index 0e87099d8..91be86b98 100644 --- a/cmd/cleanup/cleanup.go +++ b/cmd/cleanup/cleanup.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(cleanupCmd) + cmd.Root.AddCommand(commandDefintion) } -var cleanupCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "cleanup remote:path", Short: `Clean up the remote if possible`, Long: ` diff --git a/cmd/config/config.go b/cmd/config/config.go index bdfabf612..dd94ccced 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(configCmd) + cmd.Root.AddCommand(commandDefintion) } -var configCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "config", Short: `Enter an interactive configuration session.`, Run: func(command *cobra.Command, args []string) { diff --git a/cmd/copy/copy.go b/cmd/copy/copy.go index 30f94934d..58eaaeade 100644 --- a/cmd/copy/copy.go +++ b/cmd/copy/copy.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(copyCmd) + cmd.Root.AddCommand(commandDefintion) } -var copyCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "copy source:path dest:path", Short: `Copy files from source to dest, skipping already copied`, Long: ` diff --git a/cmd/dedupe/dedupe.go b/cmd/dedupe/dedupe.go index 7fbfcb5d4..357b80f5f 100644 --- a/cmd/dedupe/dedupe.go +++ b/cmd/dedupe/dedupe.go @@ -13,11 +13,11 @@ var ( ) func init() { - cmd.Root.AddCommand(dedupeCmd) - dedupeCmd.Flags().VarP(&dedupeMode, "dedupe-mode", "", "Dedupe mode interactive|skip|first|newest|oldest|rename.") + cmd.Root.AddCommand(commandDefintion) + commandDefintion.Flags().VarP(&dedupeMode, "dedupe-mode", "", "Dedupe mode interactive|skip|first|newest|oldest|rename.") } -var dedupeCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "dedupe [mode] remote:path", Short: `Interactively find duplicate files delete/rename them.`, Long: ` diff --git a/cmd/delete/delete.go b/cmd/delete/delete.go index 71583313e..b46d80f2c 100644 --- a/cmd/delete/delete.go +++ b/cmd/delete/delete.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(deleteCmd) + cmd.Root.AddCommand(commandDefintion) } -var deleteCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "delete remote:path", Short: `Remove the contents of path.`, Long: ` diff --git a/cmd/genautocomplete/genautocomplete.go b/cmd/genautocomplete/genautocomplete.go index 9d82a2321..72c227a88 100644 --- a/cmd/genautocomplete/genautocomplete.go +++ b/cmd/genautocomplete/genautocomplete.go @@ -8,10 +8,10 @@ import ( ) func init() { - cmd.Root.AddCommand(genautocompleteCmd) + cmd.Root.AddCommand(commandDefintion) } -var genautocompleteCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "genautocomplete [output_file]", Short: `Output bash completion script for rclone.`, Long: ` diff --git a/cmd/gendocs/gendocs.go b/cmd/gendocs/gendocs.go index b84752d42..7ca3f1df2 100644 --- a/cmd/gendocs/gendocs.go +++ b/cmd/gendocs/gendocs.go @@ -14,7 +14,7 @@ import ( ) func init() { - cmd.Root.AddCommand(gendocsCmd) + cmd.Root.AddCommand(commandDefintion) } const gendocFrontmatterTemplate = `--- @@ -25,7 +25,7 @@ url: %s --- ` -var gendocsCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "gendocs output_directory", Short: `Output markdown docs for rclone to the directory supplied.`, Long: ` diff --git a/cmd/listremotes/listremotes.go b/cmd/listremotes/listremotes.go index ab06ba2cd..ea6f45eb3 100644 --- a/cmd/listremotes/listremotes.go +++ b/cmd/listremotes/listremotes.go @@ -15,11 +15,11 @@ var ( ) func init() { - cmd.Root.AddCommand(listremotesCmd) - listremotesCmd.Flags().BoolVarP(&listLong, "long", "l", listLong, "Show the type as well as names.") + cmd.Root.AddCommand(commandDefintion) + commandDefintion.Flags().BoolVarP(&listLong, "long", "l", listLong, "Show the type as well as names.") } -var listremotesCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "listremotes", Short: `List all the remotes in the config file.`, Long: ` diff --git a/cmd/ls/ls.go b/cmd/ls/ls.go index 86f6c528d..4a7a49fb2 100644 --- a/cmd/ls/ls.go +++ b/cmd/ls/ls.go @@ -9,10 +9,10 @@ import ( ) func init() { - cmd.Root.AddCommand(lsCmd) + cmd.Root.AddCommand(commandDefintion) } -var lsCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "ls remote:path", Short: `List all the objects in the the path with size and path.`, Run: func(command *cobra.Command, args []string) { diff --git a/cmd/lsd/lsd.go b/cmd/lsd/lsd.go index f65cada25..f8bbc3379 100644 --- a/cmd/lsd/lsd.go +++ b/cmd/lsd/lsd.go @@ -9,10 +9,10 @@ import ( ) func init() { - cmd.Root.AddCommand(lsdCmd) + cmd.Root.AddCommand(commandDefintion) } -var lsdCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "lsd remote:path", Short: `List all directories/containers/buckets in the the path.`, Run: func(command *cobra.Command, args []string) { diff --git a/cmd/lsl/lsl.go b/cmd/lsl/lsl.go index 88a61e6be..988bdb07c 100644 --- a/cmd/lsl/lsl.go +++ b/cmd/lsl/lsl.go @@ -9,10 +9,10 @@ import ( ) func init() { - cmd.Root.AddCommand(lslCmd) + cmd.Root.AddCommand(commandDefintion) } -var lslCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "lsl remote:path", Short: `List all the objects path with modification time, size and path.`, Run: func(command *cobra.Command, args []string) { diff --git a/cmd/md5sum/md5sum.go b/cmd/md5sum/md5sum.go index b90b57772..d03b8163c 100644 --- a/cmd/md5sum/md5sum.go +++ b/cmd/md5sum/md5sum.go @@ -9,10 +9,10 @@ import ( ) func init() { - cmd.Root.AddCommand(md5sumCmd) + cmd.Root.AddCommand(commandDefintion) } -var md5sumCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "md5sum remote:path", Short: `Produces an md5sum file for all the objects in the path.`, Long: ` diff --git a/cmd/memtest/memtest.go b/cmd/memtest/memtest.go index 335ee36d8..d25d4b328 100644 --- a/cmd/memtest/memtest.go +++ b/cmd/memtest/memtest.go @@ -10,10 +10,10 @@ import ( ) func init() { - cmd.Root.AddCommand(memtestCmd) + cmd.Root.AddCommand(commandDefintion) } -var memtestCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "memtest remote:path", Short: `Load all the objects at remote:path and report memory stats.`, Hidden: true, diff --git a/cmd/mkdir/mkdir.go b/cmd/mkdir/mkdir.go index 73ec83513..82daa8baf 100644 --- a/cmd/mkdir/mkdir.go +++ b/cmd/mkdir/mkdir.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(mkdirCmd) + cmd.Root.AddCommand(commandDefintion) } -var mkdirCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "mkdir remote:path", Short: `Make the path if it doesn't already exist.`, Run: func(command *cobra.Command, args []string) { diff --git a/cmd/mount/mount.go b/cmd/mount/mount.go index f7dcf7f01..ed66cbd29 100644 --- a/cmd/mount/mount.go +++ b/cmd/mount/mount.go @@ -43,26 +43,26 @@ var ( func init() { umask = unix.Umask(0) // read the umask unix.Umask(umask) // set it back to what it was - cmd.Root.AddCommand(mountCmd) - mountCmd.Flags().BoolVarP(&noModTime, "no-modtime", "", noModTime, "Don't read the modification time (can speed things up).") - mountCmd.Flags().BoolVarP(&debugFUSE, "debug-fuse", "", debugFUSE, "Debug the FUSE internals - needs -v.") - mountCmd.Flags().BoolVarP(&noSeek, "no-seek", "", noSeek, "Don't allow seeking in files.") - mountCmd.Flags().DurationVarP(&dirCacheTime, "dir-cache-time", "", dirCacheTime, "Time to cache directory entries for.") + cmd.Root.AddCommand(commandDefintion) + commandDefintion.Flags().BoolVarP(&noModTime, "no-modtime", "", noModTime, "Don't read the modification time (can speed things up).") + commandDefintion.Flags().BoolVarP(&debugFUSE, "debug-fuse", "", debugFUSE, "Debug the FUSE internals - needs -v.") + commandDefintion.Flags().BoolVarP(&noSeek, "no-seek", "", noSeek, "Don't allow seeking in files.") + commandDefintion.Flags().DurationVarP(&dirCacheTime, "dir-cache-time", "", dirCacheTime, "Time to cache directory entries for.") // mount options - mountCmd.Flags().BoolVarP(&readOnly, "read-only", "", readOnly, "Mount read-only.") - mountCmd.Flags().BoolVarP(&allowNonEmpty, "allow-non-empty", "", allowNonEmpty, "Allow mounting over a non-empty directory.") - mountCmd.Flags().BoolVarP(&allowRoot, "allow-root", "", allowRoot, "Allow access to root user.") - mountCmd.Flags().BoolVarP(&allowOther, "allow-other", "", allowOther, "Allow access to other users.") - mountCmd.Flags().BoolVarP(&defaultPermissions, "default-permissions", "", defaultPermissions, "Makes kernel enforce access control based on the file mode.") - mountCmd.Flags().BoolVarP(&writebackCache, "write-back-cache", "", writebackCache, "Makes kernel buffer writes before sending them to rclone. Without this, writethrough caching is used.") - mountCmd.Flags().VarP(&maxReadAhead, "max-read-ahead", "", "The number of bytes that can be prefetched for sequential reads.") - mountCmd.Flags().IntVarP(&umask, "umask", "", umask, "Override the permission bits set by the filesystem.") - mountCmd.Flags().Uint32VarP(&uid, "uid", "", uid, "Override the uid field set by the filesystem.") - mountCmd.Flags().Uint32VarP(&gid, "gid", "", gid, "Override the gid field set by the filesystem.") - //mountCmd.Flags().BoolVarP(&foreground, "foreground", "", foreground, "Do not detach.") + commandDefintion.Flags().BoolVarP(&readOnly, "read-only", "", readOnly, "Mount read-only.") + commandDefintion.Flags().BoolVarP(&allowNonEmpty, "allow-non-empty", "", allowNonEmpty, "Allow mounting over a non-empty directory.") + commandDefintion.Flags().BoolVarP(&allowRoot, "allow-root", "", allowRoot, "Allow access to root user.") + commandDefintion.Flags().BoolVarP(&allowOther, "allow-other", "", allowOther, "Allow access to other users.") + commandDefintion.Flags().BoolVarP(&defaultPermissions, "default-permissions", "", defaultPermissions, "Makes kernel enforce access control based on the file mode.") + commandDefintion.Flags().BoolVarP(&writebackCache, "write-back-cache", "", writebackCache, "Makes kernel buffer writes before sending them to rclone. Without this, writethrough caching is used.") + commandDefintion.Flags().VarP(&maxReadAhead, "max-read-ahead", "", "The number of bytes that can be prefetched for sequential reads.") + commandDefintion.Flags().IntVarP(&umask, "umask", "", umask, "Override the permission bits set by the filesystem.") + commandDefintion.Flags().Uint32VarP(&uid, "uid", "", uid, "Override the uid field set by the filesystem.") + commandDefintion.Flags().Uint32VarP(&gid, "gid", "", gid, "Override the gid field set by the filesystem.") + //commandDefintion.Flags().BoolVarP(&foreground, "foreground", "", foreground, "Do not detach.") } -var mountCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "mount remote:path /path/to/mountpoint", Short: `Mount the remote as a mountpoint. **EXPERIMENTAL**`, Long: ` diff --git a/cmd/move/move.go b/cmd/move/move.go index 997bfeea1..dd0c422a2 100644 --- a/cmd/move/move.go +++ b/cmd/move/move.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(moveCmd) + cmd.Root.AddCommand(commandDefintion) } -var moveCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "move source:path dest:path", Short: `Move files from source to dest.`, Long: ` diff --git a/cmd/purge/purge.go b/cmd/purge/purge.go index 19fa6e8ee..4f5da1e6d 100644 --- a/cmd/purge/purge.go +++ b/cmd/purge/purge.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(purgeCmd) + cmd.Root.AddCommand(commandDefintion) } -var purgeCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "purge remote:path", Short: `Remove the path and all of its contents.`, Long: ` diff --git a/cmd/rmdir/rmdir.go b/cmd/rmdir/rmdir.go index 1235d53d0..476a5f069 100644 --- a/cmd/rmdir/rmdir.go +++ b/cmd/rmdir/rmdir.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(rmdirCmd) + cmd.Root.AddCommand(commandDefintion) } -var rmdirCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "rmdir remote:path", Short: `Remove the path if empty.`, Long: ` diff --git a/cmd/sha1sum/sha1sum.go b/cmd/sha1sum/sha1sum.go index 1d5e5386c..e7696055d 100644 --- a/cmd/sha1sum/sha1sum.go +++ b/cmd/sha1sum/sha1sum.go @@ -9,10 +9,10 @@ import ( ) func init() { - cmd.Root.AddCommand(sha1sumCmd) + cmd.Root.AddCommand(commandDefintion) } -var sha1sumCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "sha1sum remote:path", Short: `Produces an sha1sum file for all the objects in the path.`, Long: ` diff --git a/cmd/size/size.go b/cmd/size/size.go index 201699304..f35e0d7db 100644 --- a/cmd/size/size.go +++ b/cmd/size/size.go @@ -9,10 +9,10 @@ import ( ) func init() { - cmd.Root.AddCommand(sizeCmd) + cmd.Root.AddCommand(commandDefintion) } -var sizeCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "size remote:path", Short: `Prints the total size and number of objects in remote:path.`, Run: func(command *cobra.Command, args []string) { diff --git a/cmd/sync/sync.go b/cmd/sync/sync.go index 97783dbed..5e938a658 100644 --- a/cmd/sync/sync.go +++ b/cmd/sync/sync.go @@ -7,10 +7,10 @@ import ( ) func init() { - cmd.Root.AddCommand(syncCmd) + cmd.Root.AddCommand(commandDefintion) } -var syncCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "sync source:path dest:path", Short: `Make source and dest identical, modifying destination only.`, Long: ` diff --git a/cmd/version/version.go b/cmd/version/version.go index b5e4c1f57..143c597ee 100644 --- a/cmd/version/version.go +++ b/cmd/version/version.go @@ -6,10 +6,10 @@ import ( ) func init() { - cmd.Root.AddCommand(versionCmd) + cmd.Root.AddCommand(commandDefintion) } -var versionCmd = &cobra.Command{ +var commandDefintion = &cobra.Command{ Use: "version", Short: `Show the version number.`, Run: func(command *cobra.Command, args []string) {