Documentation ¶
Index ¶
- Constants
- Variables
- func CopyOptionsFromKeysIfNotSet(fromPtr, toPtr *Options, alreadySetKeys map[string]bool)
- func Debug() bool
- func DebugPrintf(fmt_ string, args ...interface{})
- func FDebugPrintf(f io.Writer, fmt_ string, args ...interface{})
- func FprintfShadow(f io.Writer, fmt_ string, args ...interface{})
- func JSONStringifySiftedCLITags(from interface{}, rcSourcePath string, defined map[string]bool, ...) (string, error)
- func NonEmptyStrings(v ...string) (splits []string)
- func NonEmptyTrimmedStrings(v ...string) (splits []string)
- func NotExist(err error) bool
- func PrintfShadow(fmt_ string, args ...interface{})
- func ReadFullFile(p string) (clauses []string, err error)
- func ResourceMappings(rcPath string) (map[string]map[string]interface{}, error)
- func RetrieveRefreshToken(ctx context.Context, context *config.Context) (string, error)
- func ShowAllDescriptions()
- func ShowDescription(topic string)
- func ShowDescriptions(topics ...string)
- func SiftCliTags(cs *CliSifter) string
- func StdoutPrintf(fmt_ string, args ...interface{})
- type AccountType
- type Agreement
- type ByPrecedence
- type Change
- type CliSifter
- type Commands
- func (g *Commands) About(mask int) (err error)
- func (g *Commands) Copy(byId bool) error
- func (g *Commands) DeInit() error
- func (c *Commands) DebugPrintf(fmt_ string, args ...interface{})
- func (g *Commands) Delete(byId bool) (err error)
- func (g *Commands) DeleteByMatch() error
- func (g *Commands) Diff() (err error)
- func (g *Commands) EditDescription(byId bool) (composedErr error)
- func (g *Commands) EmptyTrash() error
- func (g *Commands) Fetch() (err error)
- func (g *Commands) FetchById() (err error)
- func (g *Commands) FetchMatches() (err error)
- func (g *Commands) FileIssue() error
- func (g *Commands) FixClashes(byId bool) error
- func (g *Commands) Id() (err error)
- func (g *Commands) Init() error
- func (g *Commands) InitWithServiceAccount(gsaFilepath string) error
- func (g *Commands) List(byId bool) error
- func (g *Commands) ListClashes(byId bool) error
- func (g *Commands) ListMatches() error
- func (g *Commands) ListShared() (err error)
- func (g *Commands) Move(byId, keepParent bool) error
- func (g *Commands) NewFile() (err error)
- func (g *Commands) NewFolder() (err error)
- func (g *Commands) Open(ot OpenType) error
- func (g *Commands) Prune() (err error)
- func (c *Commands) Publish(byId bool) error
- func (g *Commands) Pull() error
- func (g *Commands) PullAllStarred() error
- func (g *Commands) PullById() error
- func (g *Commands) PullMatchLike() error
- func (g *Commands) PullPiped(byId bool) (err error)
- func (g *Commands) Push() error
- func (g *Commands) PushPiped() error
- func (g *Commands) QR(byId bool) error
- func (g *Commands) QuotaStatus(query int64) (status int, err error)
- func (g *Commands) Rename(byId bool) error
- func (c *Commands) Share(byId bool) (err error)
- func (g *Commands) Star(byId bool) error
- func (g *Commands) Stat() error
- func (g *Commands) StatById() error
- func (g *Commands) Touch(byId bool) (err error)
- func (g *Commands) TouchByMatch() (err error)
- func (g *Commands) Trash(byId bool) (err error)
- func (g *Commands) TrashByMatch() error
- func (g *Commands) UnStar(byId bool) error
- func (c *Commands) Unpublish(byId bool) error
- func (c *Commands) Unshare(byId bool) (err error)
- func (g *Commands) Untrash(byId bool) (err error)
- func (g *Commands) UntrashByMatch() error
- func (g *Commands) Url(byId bool) error
- type CrudValue
- type Error
- type ErrorStatus
- type File
- type FixClashesMode
- type OpenType
- type Operation
- type Options
- type ParentFile
- type Remote
- func (r *Remote) About() (*drive.About, error)
- func (r *Remote) Delete(id string) error
- func (r *Remote) Download(id string, exportURL string) (io.ReadCloser, error)
- func (r *Remote) EmptyTrash() error
- func (r *Remote) FindBackPaths(id string) (backPaths []string, err error)
- func (r *Remote) FindById(id string) (*File, error)
- func (r *Remote) FindByIdM(id string) *paginationPair
- func (r *Remote) FindByParentId(parentId string, hidden bool) *paginationPair
- func (r *Remote) FindByParentIdTrashed(parentId string, hidden bool) *paginationPair
- func (r *Remote) FindByPath(p string) (*File, error)
- func (r *Remote) FindByPathM(p string) *paginationPair
- func (r *Remote) FindByPathShared(p string) *paginationPair
- func (r *Remote) FindByPathTrashed(p string) (*File, error)
- func (r *Remote) FindByPathTrashedM(p string) *paginationPair
- func (r *Remote) FindMatches(mq *matchQuery) *paginationPair
- func (r *Remote) FindStarred(trashed, hidden bool) *paginationPair
- func (r *Remote) Publish(id string) (string, error)
- func (r *Remote) SetModTime(fileId string, modTime time.Time) (*File, error)
- func (r *Remote) Touch(id string) (*File, error)
- func (r *Remote) Trash(id string) error
- func (r *Remote) Unpublish(id string) error
- func (r *Remote) Untrash(id string) error
- func (r *Remote) UpsertByComparison(args *upsertOpt) (f *File, err error)
- type RenameMode
- type Role
Constants ¶
const ( Barely = iota AlmostExceeded HalfwayExceeded Exceeded Unknown )
const ( AboutNone = 1 << iota AboutQuota AboutFileSizes AboutFeatures )
const ( SelectSrc destination = 1 << iota SelectDest )
const ( DiffNone = 1 << iota DiffUnified )
const ( FetchById = iota FetchMatches Fetch )
const ( AboutKey = "about" AllKey = "all" CopyKey = "copy" DeleteKey = "delete" DeInitKey = "deinit" EditDescriptionKey = "edit-description" EditDescriptionShortKey = "edit-desc" ServiceAccountJSONFileKey = "service-account-file" DiffKey = "diff" AddressKey = "address" EmptyTrashKey = "emptytrash" FeaturesKey = "features" HelpKey = "help" InitKey = "init" LinkKey = "Link" ListKey = "list" DuKey = "du" Md5sumKey = "md5sum" MoveKey = "move" OcrKey = "ocr" ConvertKey = "convert" OSLinuxKey = "linux" PullKey = "pull" PipedKey = "piped" PushKey = "push" PubKey = "pub" QRLinkKey = "qr" RenameKey = "rename" QuotaKey = "quota" StatKey = "stat" TouchKey = "touch" TrashKey = "trash" UntrashKey = "untrash" UnpubKey = "unpub" VersionKey = "version" NewKey = "new" IndexKey = "index" PruneKey = "prune" StarKey = "star" UnStarKey = "unstar" CoercedMimeKeyKey = "coerced-mime" ExportsKey = "export" ExportsDirKey = "exports-dir" NoClobberKey = "no-clobber" RecursiveKey = "recursive" IgnoreChecksumKey = "ignore-checksum" ExcludeOpsKey = "exclude-ops" IgnoreConflictKey = "ignore-conflict" IgnoreNameClashesKey = "ignore-name-clashes" ClashesKey = "clashes" CommentStr = "#" DepthKey = "depth" EmailsKey = "emails" EmailMessageKey = "emailMessage" ForceKey = "force" QuietKey = "quiet" IdKey = "id" QuitShortKey = "q" YesShortKey = "Y" QuitLongKey = "quit" MatchesKey = "matches" HiddenKey = "hidden" Md5Key = "md5" NoPromptKey = "no-prompt" SizeKey = "size" NameKey = "name" OpenKey = "open" OriginalNameKey = "oname" ModTimeKey = "modt" LastViewedByMeTimeKey = "lvt" AccountTypeKey = "account-type" RoleKey = "role" TypeKey = "type" TrashedKey = "trashed" SkipMimeKeyKey = "skip-mime" MatchMimeKeyKey = "exact-mime" ExactTitleKey = "exact-title" MatchOwnerKey = "match-owner" ExactOwnerKey = "exact-owner" NotOwnerKey = "skip-owner" SortKey = "sort" FolderKey = "folder" MimeKey = "mime-key" PageSizeKey = "pagesize" DriveRepoRelPath = "github.com/odeke-em/drive" UrlKey = "url" ReportIssueKey = "report-issue" IssueTitleKey = "title" IssueBodyKey = "body" SkipContentCheckKey = "skip-content-check" TouchModTimeKey = "time" TouchTimeFmtSpecifierKey = "format" TouchOffsetDurationKey = "duration" )
const ( DescAbout = "print out information about your Google drive" DescAll = "print out the entire help section" DescAllStarred = "all the starred files" DescCopy = "copy remote paths to a destination" DescDelete = "deletes the items permanently. This operation is irreversible" DescDiff = "compares local files with their remote equivalent" DescEdit = "edit the attributes of a file" DescEmptyTrash = "permanently cleans out your trash" DescExcludeOps = "exclude operations" DescFeatures = "returns information about the features of your drive" DescIndex = "fetch indices from remote" DescHelp = "Get help for a topic" DescInit = "initializes a directory and authenticates user" DescDeInit = "removes the user's credentials and initialized files" DescList = "lists the contents of remote path" DescMove = "move files/folders" DescPiped = "get content in from standard input (stdin)" DescQuota = "prints out information related to your quota space" DescPublish = "publishes a file and prints its publicly available url" DescRename = "renames a file/folder" DescPull = "pulls remote changes from Google Drive" DescPruneIndices = "remove stale indices" DescPush = "push local changes to Google Drive" DescStar = "star files" DescUnStar = "unstar files" DescStat = "display information about a file" DescTouch = "updates a remote file's modification time to that currently on the server" DescTrash = "moves files to trash" DescUntrash = "restores files from trash to their original locations" DescUnpublish = "revokes public access to a file" DescVersion = "prints the version" DescMd5sum = "prints a list compatible with md5sum(1)" DescDu = "similar to util `du` gives you disk usage" DescAccountTypes = "\n\t* anyone.\n\t* user.\n\t* domain.\n\t* group" DescRoles = "\n\t* owner.\n\t* reader.\n\t* writer.\n\t* commenter." DescExplicitylPullExports = "explicitly pull exports" DescIgnoreChecksum = "avoids computation of checksums as a final check." + "\nUse cases may include:\n\t* when you are low on bandwidth e.g SSHFS." + "\n\t* Are on a low power device" DescIgnoreConflict = "turns off the conflict resolution safety" DescIgnoreNameClashes = "ignore name clashes" DescSort = "" /* 151-byte string literal not displayed */ DescSkipMime = "skip elements with mimeTypes derived from these extensions" DescMatchMime = "get elements with the exact mimeTypes derived from extensions" DescMatchTitle = "elements with matching titles" DescExactTitle = "get elements with the exact titles" DescMatchOwner = "elements with matching owners" DescExactOwner = "elements with the exact owner" DescNotOwner = "ignore elements owned by these users" DescNew = "create a new file/folder" DescAllIndexOperations = "perform all the index related operations" DescOpen = "open a file in the appropriate filemanager or default browser" DescUrl = "returns the remote URL of each file" DescVerbose = "show step by step information verbosely" DescFixClashes = "fix clashes by renaming or trashing all files" DescFixClashesMode = "set fix policy to rename or trash" DescListClashes = "list clashes" DescDescription = "set the description" DescQR = "open up the QR code for specified files" DescStarred = "operate only on starred files" DescUnifiedDiff = "unified diff" DescDiffBaseLocal = "when set uses local as the base other remote will be used as the base" DescClashesOpById = "operate on clashes by id instead of by path" DescIssueBody = "the detailed description of the issue being filed" DescIssueTitle = "the title of the issue being filed" DescReportIssue = "report an issue to the project's issue tracker" DescId = "retrieve the fileId for the specified paths" DescSkipContentCheck = "skip diffing actual body content, show only name, time, type changes" DescPushDestination = "specify the final destination of the contents of an operation" DescExponentialBackoffRetryCount = "max number of retries for exponential backoff" DescEncryptionPassword = "encryption password" DescDecryptionPassword = "decryption password" DescWithLink = "turn off file indexing so that only those with the link can view it" DescAllowDesktopLinks = "allows docs + sheets to be pulled as .desktop files or URL linked files" DescKeepParent = "" /* 137-byte string literal not displayed */ DescTouchTimeStr = "the time each file's modification time should be set to" DescTouchOffsetDuration = "" /* 137-byte string literal not displayed */ DescTouchTimeFmtSpecifier = "" /* 181-byte string literal not displayed */ )
const ( CLIOptionDescription = "description" CLIOptionExplicitlyExport = "explicitly-export" CLIOptionIgnoreChecksum = "ignore-checksum" CLIOptionIgnoreConflict = "ignore-conflict" CLIOptionIgnoreNameClashes = "ignore-name-clashes" CLIOptionExcludeOperations = "exclude-ops" CLIOptionId = "id" CLIOptionNoClobber = "no-clobber" CLIOptionNotify = "notify" CLIOptionSkipMime = "skip-mime" CLIOptionExactMime = "exact-mime" CLIOptionMatchMime = "match-mime" CLIOptionExactTitle = "exact-title" CLIOptionMatchTitle = "match-title" CLIOptionExactOwner = "exact-owner" CLIOptionMatchOwner = "match-owner" CLIOptionNotOwner = "skip-owner" CLIOptionPruneIndices = "prune" CLIOptionAllIndexOperations = "all-ops" CLIOptionVerboseKey = "verbose" CLIOptionVerboseShortKey = "v" CLIOptionOpen = "open" CLIOptionWebBrowser = "web-browser" CLIOptionFileBrowser = "file-browser" CLIOptionDirectories = "directories" CLIOptionFiles = "files" CLIOptionLongFmt = "long" CLIOptionFixClashesKey = "fix-clashes" CLIOptionPiped = "piped" CLIOptionStarred = "starred" CLIOptionAllStarred = "all" CLIOptionUnified = "unified" CLIOptionUnifiedShortKey = "u" CLIOptionDiffBaseLocal = "base-local" CLIOptionFixClashes = "fix" CLIOptionFixClashesMode = "fix-mode" CLIOptionListClashes = "list" CLIOptionPushDestination = "destination" CLIOptionRenameLocal = "local" CLIOptionRenameRemote = "remote" CLIOptionRetryCount = "retry-count" CLIEncryptionPassword = "encryption-password" CLIDecryptionPassword = "decryption-password" CLIOptionWithLink = "with-link" CLIOptionDesktopLinks = "desktop-links" CLIOptionKeepParent = "keep-parent" CLIOptionUploadChunkSize = "upload-chunk-size" CLIOptionUploadRateLimit = "upload-rate-limit" CLIOptionExportsDumpToSameDirectory = "same-exports-dir" CLIOptionTrashed = TrashedKey )
const ( GoogleApiClientIdEnvKey = "GOOGLE_API_CLIENT_ID" GoogleApiClientSecretEnvKey = "GOOGLE_API_CLIENT_SECRET" DriveGoMaxProcsKey = "DRIVE_GOMAXPROCS" GoMaxProcsKey = "GOMAXPROCS" )
const ( TBool = iota TRune TInt TInt64 TUInt TString TStringArray TUInt64 )
const ( MimeTypeJoiner = "-" RemoteSeparator = "/" FmtTimeString = "2006-01-02T15:04:05.000Z" MsgClashesFixedNowRetry = "Clashes were fixed, please retry the operation" MsgErrFileNotMutable = "File not mutable" DriveIgnoreSuffix = ".driveignore" DriveIgnoreNegativeLookAheadToken = "!" )
const ( // Since we'll be sharing `TypeMask` with other bit flags // we'll need to avoid collisions with other args InTrash int = 1 << (31 - 1 - iota) Folder Owners Minimal Starred NonFolder DiskUsageOnly CurrentVersion )
const ( TypeNone pullType = 1 << iota TypeAll TypeById TypeMatches TypeStarred TypeAllStarred )
const ( // OAuth 2.0 OOB redirect URL for authorization. RedirectURL = "urn:ietf:wg:oauth:2.0:oob" // OAuth 2.0 full Drive scope used for authorization. DriveScope = "https://www.googleapis.com/auth/drive" // OAuth 2.0 access type for offline/refresh access. AccessType = "offline" // Google Drive webpage host DriveResourceHostURL = "https://googledrive.com/host/" // Google Drive entry point DriveResourceEntryURL = "https://drive.google.com" DriveRemoteSep = "/" )
const ( OptNone = 1 << iota OptConvert OptOCR OptUpdateViewedDate OptContentAsIndexableText OptPinned OptNewRevision )
const ( Notify WithLink )
const ( AttrUnknown = iota AttrSize AttrModTime AttrLastViewedByMeTime AttrVersion AttrIsDir AttrMd5Checksum AttrMimeType AttrName )
const ( DifferNone = 0 DifferDirType = 1 << iota DifferMd5Checksum DifferModTime DifferSize )
const ( Not fuzziness = 1 << iota Like NotIn Is )
const ( Or joiner = 1 << iota And )
const (
DefaultMaxTraversalDepth = -1
)
const (
)const (
DefaultTouchTimeSpecifier = "20060102150405"
)
const (
DesktopExtension = "desktop"
)
const (
DriveFolderMimeType = "application/vnd.google-apps.folder"
)
const (
DriveResourceConfiguration = ".driverc"
)
const (
InfiniteDepth = -1
)
const (
MaxFailedRetryCount = 20 // Arbitrary value
)
const MaxFileSize = 50 * 1024 * 1024
MaxFileSize is the max number of bytes we can accept for diffing (Arbitrary value)
const (
ProjectNewIssueUrl = "https://github.com/odeke-em/drive/issues/new"
)
const Version = "0.3.9.1"
Variables ¶
var ( HomeEnvKey = "HOME" HomeShellEnvKey = "$" + HomeEnvKey FsHomeDir = os.Getenv(HomeEnvKey) )
var ( ErrPathNotExists = nonExistantRemoteErr(fmt.Errorf("remote path doesn't exist")) ErrNetLookup = netLookupFailedErr(fmt.Errorf("net lookup failed")) ErrClashesDetected = clashesDetectedErr(fmt.Errorf("clashes detected. Use `%s` to override this behavior or `%s` to try fixing this", CLIOptionIgnoreNameClashes, CLIOptionFixClashesKey)) ErrClashFixingAborted = clashFixingAbortedErr(fmt.Errorf("clash fixing aborted")) ErrGoogleAPIInvalidQueryHardCoded = invalidGoogleAPIQueryErr(fmt.Errorf("GoogleAPI: Error 400: Invalid query, invalid")) )
var ( UnescapedPathSep = fmt.Sprintf("%c", os.PathSeparator) EscapedPathSep = url.QueryEscape(UnescapedPathSep) )
var Aliases = createAndRegisterAliases()
var BigFileSize = int64(1024 * 1024 * 400)
Arbitrary value. TODO: Get better definition of BigFileSize.
var BytesPerKB = float64(1024)
var DefaultMaxProcs = runtime.NumCPU()
var (
ErrNoContext = errors.New("not in a drive context")
)
var ErrPathNotDir = errors.New("not a directory")
var (
ErrRcNoKeysMatched = errors.New("rcMapping: no keys matched")
)
var ( // ErrRejectedTerms is empty "" because messages might be too // verbose to affirm a rejection that a user has already seen ErrRejectedTerms = errors.New("") )
var (
PermanentDeletionNoPromptError = fmt.Errorf("%q is set yet performing a permanent deletion. Please see issue https://github.com/odeke-em/drive/issues/448", NoPromptKey)
)
var Ruler = strings.Repeat("*", 4)
Functions ¶
func Debug ¶
func Debug() bool
Debug returns true if DRIVE_DEBUG is set in the environment. Set it to anything non-empty, for example `DRIVE_DEBUG=true`.
func DebugPrintf ¶
func DebugPrintf(fmt_ string, args ...interface{})
func FDebugPrintf ¶
FDebugPrintf will only print output to the out writer if environment variable `DRIVE_DEBUG` is set. It prints out a header on a newline containing the introspection of the callsite, and then the formatted message you'd like, appending an obligatory newline at the end. The output will be of the form: [<FILE>:<FUNCTION>:<LINE_NUMBER>] <MSG>\n
func FprintfShadow ¶
func NonEmptyStrings ¶
func NonEmptyTrimmedStrings ¶
func PrintfShadow ¶
func PrintfShadow(fmt_ string, args ...interface{})
func ReadFullFile ¶
func ResourceMappings ¶
func RetrieveRefreshToken ¶
func ShowAllDescriptions ¶
func ShowAllDescriptions()
func ShowDescription ¶
func ShowDescription(topic string)
func ShowDescriptions ¶
func ShowDescriptions(topics ...string)
func SiftCliTags ¶
func StdoutPrintf ¶
func StdoutPrintf(fmt_ string, args ...interface{})
Types ¶
type AccountType ¶
type AccountType int
const ( UnknownAccountType AccountType = 1 << iota Anyone User Domain Group )
func (*AccountType) String ¶
func (a *AccountType) String() string
type ByPrecedence ¶
type ByPrecedence []*Change
func (ByPrecedence) Len ¶
func (cl ByPrecedence) Len() int
func (ByPrecedence) Less ¶
func (cl ByPrecedence) Less(i, j int) bool
func (ByPrecedence) Swap ¶
func (cl ByPrecedence) Swap(i, j int)
type Change ¶
type Commands ¶
type Commands struct {
// contains filtered or unexported fields
}
func (*Commands) DebugPrintf ¶
func (*Commands) DeleteByMatch ¶
func (*Commands) EditDescription ¶
func (*Commands) EmptyTrash ¶
func (*Commands) FetchMatches ¶
func (*Commands) FixClashes ¶
func (*Commands) InitWithServiceAccount ¶
We don't need to perform an OAuth2.0 exchange
func (*Commands) ListClashes ¶
func (*Commands) ListMatches ¶
func (*Commands) ListShared ¶
func (*Commands) Pull ¶
Pull from remote if remote path exists and in a god context. If path is a directory, it recursively pulls from the remote if there are remote changes. It doesn't check if there are remote changes if isForce is set.
func (*Commands) PullAllStarred ¶
func (*Commands) PullMatchLike ¶
func (*Commands) Push ¶
Pushes to remote if local path exists and in a gd context. If path is a directory, it recursively pushes to the remote if there are local changes. It doesn't check if there are local changes if isForce is set.
func (*Commands) TouchByMatch ¶
func (*Commands) TrashByMatch ¶
func (*Commands) UntrashByMatch ¶
type ErrorStatus ¶
type ErrorStatus int
const ( StatusGeneric ErrorStatus = 1 StatusAuthenticationFailed ErrorStatus = 2 StatusRetriesExhausted ErrorStatus = 3 StatusDownloadFailed ErrorStatus = 4 StatusPullFailed ErrorStatus = 5 StatusGoogleDocNonExportAttempted ErrorStatus = 6 StatusInvalidGoogleAPIQuery ErrorStatus = 7 StatusIllogicalState ErrorStatus = 8 StatusNonExistantRemote ErrorStatus = 9 StatusRemoteLookupFailed ErrorStatus = 10 StatusLocalLookupFailed ErrorStatus = 11 StatusNetLookupFailed ErrorStatus = 12 StatusClashesDetected ErrorStatus = 13 StatusClashFixingAborted ErrorStatus = 14 StatusMkdirFailed ErrorStatus = 15 StatusNoMatchesFound ErrorStatus = 16 StatusUnresolvedConflicts ErrorStatus = 17 StatusCannotPrompt ErrorStatus = 18 StatusOverwriteAttempted ErrorStatus = 19 StatusImmutableOperationAttempted ErrorStatus = 20 StatusInvalidArguments ErrorStatus = 21 StatusNamedPipeReadAttempt ErrorStatus = 22 StatusContentTooLarge ErrorStatus = 23 StatusClashesFixed ErrorStatus = 24 StatusSecurityException ErrorStatus = 25 )
type File ¶
type File struct { // AlternateLink opens the file in a relevant Google editor or viewer AlternateLink string BlobAt string // Copyable decides if the user has allowed for the file to be copied Copyable bool ExportLinks map[string]string Id string IsDir bool Md5Checksum string MimeType string ModTime time.Time LastViewedByMeTime time.Time Name string Size int64 Etag string // UserPermission contains the permissions for the authenticated user on this file UserPermission *drive.Permission // CacheChecksum when set avoids recomputation of checksums CacheChecksum bool // Monotonically increasing version number for the file Version int64 // The onwers of this file. OwnerNames []string // Permissions contains the overall permissions for this file Permissions []*drive.Permission LastModifyingUsername string OriginalFilename string Labels *drive.FileLabels Description string Parents []*ParentFile QuotaBytesUsed int64 }
func NewRemoteFile ¶
type FixClashesMode ¶
type FixClashesMode uint8
const ( FixClashesRename FixClashesMode = 1 + iota FixClashesTrash )
type Options ¶
type Options struct { // Depth is the number of pages/ listing recursion depth Depth int // Exports contains the formats to export your Google Docs + Sheets to // e.g ["csv" "txt"] Exports []string // ExportsDir is the directory to put the exported Google Docs + Sheets. // If not provided, will export them to the same dir as the source files are ExportsDir string // ExportsDumpToSameDirectory when set, requests that all exports be put in the // same directory instead of in a directory that is prefixed first by the file name ExportsDumpToSameDirectory bool // Force once set always converts NoChange into an Addition Force bool // Hidden discovers hidden paths if set Hidden bool Ignorer func(string) bool // IgnoreChecksum when set avoids the step // of comparing checksums as a final check. IgnoreChecksum bool // IgnoreConflict when set turns off the conflict resolution safety. IgnoreConflict bool // Allows listing of content in trash InTrash bool Meta *map[string][]string Mount *config.Mount // NoClobber when set prevents overwriting of stale content NoClobber bool // NoPrompt overwrites any prompt pauses NoPrompt bool Path string // PageSize determines the number of results returned per API call PageSize int64 Recursive bool // Sources is a of list all paths that are // within the scope/path of the current gd context Sources []string // TypeMask contains the result of setting different type bits e.g // Folder to search only for folders etc. TypeMask int // Piped when set means to infer content to or from stdin Piped bool // Quiet when set toggles only logging of errors to stderrs as // well as reading from stdin in this case stdout is not logged to Quiet bool StdoutIsTty bool IgnoreNameClashes bool ExcludeCrudMask CrudValue ExplicitlyExport bool Md5sum bool Verbose bool FixClashes bool FixClashesMode FixClashesMode Match bool Starred bool // BaseLocal when set, during a diff uses the local file // as the base otherwise remote is used as the base BaseLocal bool // Destination when set is the final logical location of the // constituents of an operation for example a push or pull. // See issue #612. Destination string RenameMode RenameMode ExponentialBackoffRetryCount int Encrypter func(io.Reader) (io.Reader, error) Decrypter func(io.Reader) (io.ReadCloser, error) // AllowURLLinkedFiles when set signifies that the user // depending on their OS, wants us to create for them // clickable files where applicable. // See issue #697. AllowURLLinkedFiles bool // Chunksize is the size per block of data uploaded. // If not set, the default value from googleapi.DefaultUploadChunkSize // is used instead. // If UploadChunkSize is not set yet UploadRateLimit is, UploadChunkSize will be the same as UploadRateLimit. UploadChunkSize int // Limit the upload bandwidth to n KiB/s. UploadRateLimit int // contains filtered or unexported fields }
func (*Options) CryptoEnabled ¶
type ParentFile ¶
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
func NewRemoteContextFromServiceAccount ¶
NewRemoteContextFromServiceAccount returns a remote initialized with credentials from a Google Service Account. For more information about these accounts, see: https://developers.google.com/identity/protocols/OAuth2ServiceAccount https://developers.google.com/accounts/docs/application-default-credentials
You'll also need to configure access to Google Drive.
func (*Remote) EmptyTrash ¶
func (*Remote) FindBackPaths ¶
func (*Remote) FindByParentId ¶
func (*Remote) FindByParentIdTrashed ¶
func (*Remote) FindByPathM ¶
func (*Remote) FindByPathShared ¶
func (*Remote) FindByPathTrashedM ¶
func (*Remote) FindMatches ¶
func (r *Remote) FindMatches(mq *matchQuery) *paginationPair
func (*Remote) FindStarred ¶
func (*Remote) SetModTime ¶
SetModTime is an explicit command to just set the modification time of a remote file. It serves the purpose of Touch but with a custom time instead of the time on the remote server. See Issue https://github.com/odeke-em/drive/issues/726.
func (*Remote) UpsertByComparison ¶
type RenameMode ¶
type RenameMode uint
const ( RenameNone RenameMode = 1 << iota RenameRemote RenameLocal )