drive

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2016 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Barely = iota
	AlmostExceeded
	HalfwayExceeded
	Exceeded
	Unknown
)
View Source
const (
	AboutNone = 1 << iota
	AboutQuota
	AboutFileSizes
	AboutFeatures
)
View Source
const (
	SelectSrc destination = 1 << iota
	SelectDest
)
View Source
const (
	DiffNone = 1 << iota
	DiffUnified
)
View Source
const (
	FetchById = iota
	FetchMatches
	Fetch
)
View Source
const (
	AboutKey                = "about"
	AllKey                  = "all"
	CopyKey                 = "copy"
	DeleteKey               = "delete"
	DeInitKey               = "deinit"
	EditDescriptionKey      = "edit-description"
	EditDescriptionShortKey = "edit-desc"
	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"
	ShareKey                = "share"
	StatKey                 = "stat"
	TouchKey                = "touch"
	TrashKey                = "trash"
	UnshareKey              = "unshare"
	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"
)
View Source
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"
	DescShare                 = "share files with specific emails giving the specified users specifies roles and permissions"
	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"
	DescUnshare               = "revoke a user's access to a file"
	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               = "sort items in the order\n\t* md5.\n\t* name.\n\t* size.\n\t* type.\n\t* version"
	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 files"
	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"
)
View Source
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"
	CLIOptionListClashes        = "list"
)
View Source
const (
	GoogleApiClientIdEnvKey     = "GOOGLE_API_CLIENT_ID"
	GoogleApiClientSecretEnvKey = "GOOGLE_API_CLIENT_SECRET"
	DriveGoMaxProcsKey          = "DRIVE_GOMAXPROCS"
	GoMaxProcsKey               = "GOMAXPROCS"
)
View Source
const (
	TBool = iota
	TRune
	TInt
	TInt64
	TUInt
	TString
	TStringArray
	TUInt64
)
View Source
const (
	InTrash = 1 << iota
	Folder
	Shared
	Owners
	Minimal
	Starred
	NonFolder
	DiskUsageOnly
	CurrentVersion
)
View Source
const (
	MimeTypeJoiner      = "-"
	RemoteDriveRootPath = "My Drive"
	RemoteSeparator     = "/"

	FmtTimeString           = "2006-01-02T15:04:05.000Z"
	MsgClashesFixedNowRetry = "Clashes were fixed, please retry the operation"
	MsgErrFileNotMutable    = "File not mutable"

	DriveIgnoreSuffix                 = ".driveignore"
	DriveIgnoreNegativeLookAheadToken = "!"
)
View Source
const (
	TypeNone pullType = 1 << iota
	TypeAll
	TypeById
	TypeMatches
	TypeStarred
	TypeAllStarred
)
View Source
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 = "/"
)
View Source
const (
	OptNone = 1 << iota
	OptConvert
	OptOCR
	OptUpdateViewedDate
	OptContentAsIndexableText
	OptPinned
	OptNewRevision
)
View Source
const (
	NoopOnShare = 1 << iota
	Notify
)
View Source
const (
	AttrUnknown = iota
	AttrSize
	AttrModTime
	AttrLastViewedByMeTime
	AttrVersion
	AttrIsDir
	AttrMd5Checksum
	AttrMimeType
	AttrName
)
View Source
const (
	DifferNone    = 0
	DifferDirType = 1 << iota
	DifferMd5Checksum
	DifferModTime
	DifferSize
)
View Source
const (
	Not fuzziness = 1 << iota
	Like
	NotIn
	Is
)
View Source
const (
	Or joiner = 1 << iota
	And
)
View Source
const (
	DefaultMaxTraversalDepth = -1
)
View Source
const (
	DefaultQRShareServer = "https://qr-server.herokuapp.com/drive"
)
View Source
const (
	DesktopExtension = "desktop"
)
View Source
const (
	DriveFolderMimeType = "application/vnd.google-apps.folder"
)
View Source
const (
	DriveResourceConfiguration = ".driverc"
)
View Source
const (
	InfiniteDepth = -1
)
View Source
const (
	MaxFailedRetryCount = uint32(20) // Arbitrary value
)
View Source
const MaxFileSize = 50 * 1024 * 1024

MaxFileSize is the max number of bytes we can accept for diffing (Arbitrary value)

View Source
const (
	ProjectNewIssueUrl = "https://github.com/odeke-em/drive/issues/new"
)
View Source
const Version = "0.3.5"

Variables

View Source
var (
	HomeEnvKey      = "HOME"
	HomeShellEnvKey = "$" + HomeEnvKey
	FsHomeDir       = os.Getenv(HomeEnvKey)
)
View Source
var (
	ErrPathNotExists   = errors.New("remote path doesn't exist")
	ErrNetLookup       = errors.New("net lookup failed")
	ErrClashesDetected = fmt.Errorf("clashes detected. Use `%s` to override this behavior or `%s` to try fixing this",
		CLIOptionIgnoreNameClashes, CLIOptionFixClashesKey)
	ErrClashFixingAborted             = fmt.Errorf("clash fixing aborted")
	ErrGoogleApiInvalidQueryHardCoded = errors.New("googleapi: Error 400: Invalid query, invalid")
)
View Source
var (
	UnescapedPathSep = fmt.Sprintf("%c", os.PathSeparator)
	EscapedPathSep   = url.QueryEscape(UnescapedPathSep)
)
View Source
var Aliases = createAndRegisterAliases()
View Source
var BigFileSize = int64(1024 * 1024 * 400)

Arbitrary value. TODO: Get better definition of BigFileSize.

View Source
var BytesPerKB = float64(1024)
View Source
var DefaultMaxProcs = runtime.NumCPU()
View Source
var (
	ErrNoContext = errors.New("not in a drive context")
)
View Source
var ErrPathNotDir = errors.New("not a directory")
View Source
var (
	ErrRcNoKeysMatched = errors.New("rcMapping: no keys matched")
)
View Source
var (
	// ErrRejectedTerms is empty "" because messages might be too
	// verbose to affirm a rejection that a user has already seen
	ErrRejectedTerms = errors.New("")
)
View Source
var (
	PermanentDeletionNoPromptError = fmt.Errorf("%q is set yet performing a permanent deletion. Please see issue https://github.com/odeke-em/drive/issues/448", NoPromptKey)
)
View Source
var Ruler = strings.Repeat("*", 4)

Functions

func CopyOptionsFromKeysIfNotSet added in v0.3.2

func CopyOptionsFromKeysIfNotSet(fromPtr, toPtr *Options, alreadySetKeys map[string]bool)

func FprintfShadow added in v0.3.1

func FprintfShadow(f io.Writer, fmt_ string, args ...interface{})

func JSONStringifySiftedCLITags added in v0.3.2

func JSONStringifySiftedCLITags(from interface{}, rcSourcePath string, defined map[string]bool) (repr string, err error)

func NonEmptyStrings

func NonEmptyStrings(v ...string) (splits []string)

func NonEmptyTrimmedStrings added in v0.2.0

func NonEmptyTrimmedStrings(v ...string) (splits []string)

func NotExist added in v0.3.2

func NotExist(err error) bool

func PrintfShadow added in v0.3.1

func PrintfShadow(fmt_ string, args ...interface{})

func ReadFullFile added in v0.2.7

func ReadFullFile(p string) (clauses []string, err error)

func ResourceMappings added in v0.3.2

func ResourceMappings(rcPath string) (parsed map[string]interface{}, err error)

func RetrieveRefreshToken

func RetrieveRefreshToken(ctx context.Context, context *config.Context) (string, error)

func ShowAllDescriptions

func ShowAllDescriptions()

func ShowDescription

func ShowDescription(topic string)

func ShowDescriptions added in v0.2.4

func ShowDescriptions(topics ...string)

func SiftCliTags added in v0.3.2

func SiftCliTags(cs *CliSifter) string

func StdoutPrintf added in v0.3.1

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 Agreement added in v0.3.3

type Agreement int
const (
	NotApplicable Agreement = 1 << iota
	Rejected
	Accepted
	AcceptedImplicitly
)

func (*Agreement) Error added in v0.3.3

func (ag *Agreement) Error() error

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 Change struct {
	Dest           *File
	Parent         string
	Path           string
	Src            *File
	Force          bool
	NoClobber      bool
	IgnoreConflict bool
	IgnoreChecksum bool
	// contains filtered or unexported fields
}

func (*Change) Op

func (c *Change) Op() Operation

func (*Change) Symbol

func (c *Change) Symbol() string

type CliSifter added in v0.3.2

type CliSifter struct {
	From           interface{}
	Defaults       map[string]interface{}
	AlreadyDefined map[string]bool
}

type Commands

type Commands struct {
	// contains filtered or unexported fields
}

func New

func New(context *config.Context, opts *Options) *Commands

func (*Commands) About

func (g *Commands) About(mask int) (err error)

func (*Commands) Copy

func (g *Commands) Copy(byId bool) error

func (*Commands) DeInit added in v0.2.6

func (g *Commands) DeInit() error

func (*Commands) Delete added in v0.2.0

func (g *Commands) Delete(byId bool) (err error)

func (*Commands) DeleteByMatch added in v0.2.0

func (g *Commands) DeleteByMatch() error

func (*Commands) Diff

func (g *Commands) Diff() (err error)

func (*Commands) EditDescription added in v0.3.1

func (g *Commands) EditDescription(byId bool) (composedErr error)

func (*Commands) EmptyTrash

func (g *Commands) EmptyTrash() error

func (*Commands) Fetch added in v0.2.5

func (g *Commands) Fetch() (err error)

func (*Commands) FetchById added in v0.2.5

func (g *Commands) FetchById() (err error)

func (*Commands) FetchMatches added in v0.2.5

func (g *Commands) FetchMatches() (err error)

func (*Commands) FileIssue added in v0.3.5

func (g *Commands) FileIssue() error

func (*Commands) FixClashes added in v0.3.5

func (g *Commands) FixClashes(byId bool) error

func (*Commands) Id added in v0.3.5

func (g *Commands) Id() (err error)

func (*Commands) Init

func (g *Commands) Init() error

func (*Commands) List

func (g *Commands) List(byId bool) error

func (*Commands) ListClashes added in v0.3.5

func (g *Commands) ListClashes(byId bool) error

func (*Commands) ListMatches added in v0.1.7

func (g *Commands) ListMatches() error

func (*Commands) ListShared added in v0.2.1

func (g *Commands) ListShared() (err error)

func (*Commands) Move

func (g *Commands) Move(byId bool) error

func (*Commands) NewFile added in v0.2.5

func (g *Commands) NewFile() (err error)

func (*Commands) NewFolder added in v0.2.5

func (g *Commands) NewFolder() (err error)

func (*Commands) Open added in v0.2.9

func (g *Commands) Open(ot OpenType) error

func (*Commands) Prune added in v0.2.5

func (g *Commands) Prune() (err error)

func (*Commands) Publish

func (c *Commands) Publish(byId bool) (err error)

func (*Commands) Pull

func (g *Commands) Pull() error

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 added in v0.3.3

func (g *Commands) PullAllStarred() error

func (*Commands) PullById added in v0.3.3

func (g *Commands) PullById() error

func (*Commands) PullMatchLike added in v0.3.3

func (g *Commands) PullMatchLike() error

func (*Commands) PullPiped

func (g *Commands) PullPiped(byId bool) (err error)

func (*Commands) Push

func (g *Commands) Push() (err error)

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) PushPiped

func (g *Commands) PushPiped() (err error)

func (*Commands) QR added in v0.3.2

func (g *Commands) QR(byId bool) error

func (*Commands) QuotaStatus

func (g *Commands) QuotaStatus(query int64) (status int, err error)

func (*Commands) Rename

func (g *Commands) Rename(byId bool) error

func (*Commands) Share

func (c *Commands) Share(byId bool) (err error)

func (*Commands) Star added in v0.3.3

func (g *Commands) Star(byId bool) error

func (*Commands) Stat

func (g *Commands) Stat() error

func (*Commands) StatById added in v0.2.2

func (g *Commands) StatById() error

func (*Commands) Touch

func (g *Commands) Touch(byId bool) (err error)

func (*Commands) TouchByMatch

func (g *Commands) TouchByMatch() (err error)

func (*Commands) Trash

func (g *Commands) Trash(byId bool) (err error)

func (*Commands) TrashByMatch

func (g *Commands) TrashByMatch() error

func (*Commands) UnStar added in v0.3.3

func (g *Commands) UnStar(byId bool) error

func (*Commands) Unpublish

func (c *Commands) Unpublish(byId bool) error

func (*Commands) Unshare

func (c *Commands) Unshare(byId bool) (err error)

func (*Commands) Untrash

func (g *Commands) Untrash(byId bool) (err error)

func (*Commands) UntrashByMatch

func (g *Commands) UntrashByMatch() error

func (*Commands) Url added in v0.2.9

func (g *Commands) Url(byId bool) error

type CrudValue added in v0.2.0

type CrudValue int
const (
	None   CrudValue = 0
	Create CrudValue = 1 << iota
	Read
	Update
	Delete
)
var (
	AllCrudOperations CrudValue = Create | Read | Update | Delete
)

func CrudAtoi added in v0.2.0

func CrudAtoi(ops ...string) CrudValue

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
	Shared             bool
	// 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
}

func DupFile

func DupFile(f *File) *File

func NewLocalFile

func NewLocalFile(absPath string, f os.FileInfo) *File

func NewRemoteFile

func NewRemoteFile(f *drive.File) *File

func (*File) ToIndex

func (f *File) ToIndex() *config.Index

func (*File) Url added in v0.2.9

func (f *File) Url() (url string)

type OpenType added in v0.2.9

type OpenType uint
const (
	OpenNone OpenType = 1 << iota
	FileManagerOpen
	BrowserOpen
	IdOpen
)

type Operation added in v0.1.8

type Operation int
const (
	OpNone Operation = 1 << iota
	OpAdd
	OpDelete
	OpIndexAddition
	OpMod
	OpModConflict
)

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
	// 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
	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
	// contains filtered or unexported fields
}

type ParentFile added in v0.3.3

type ParentFile struct {
	Id         string
	IsRoot     bool
	SelfLink   string
	ParentLink string
}

type Remote

type Remote struct {
	// contains filtered or unexported fields
}

func NewRemoteContext

func NewRemoteContext(context *config.Context) *Remote

func (*Remote) About

func (r *Remote) About() (about *drive.About, err error)

func (*Remote) Delete added in v0.2.0

func (r *Remote) Delete(id string) error

func (*Remote) Download

func (r *Remote) Download(id string, exportURL string) (io.ReadCloser, error)

func (*Remote) EmptyTrash

func (r *Remote) EmptyTrash() error

func (*Remote) FindBackPaths added in v0.3.3

func (r *Remote) FindBackPaths(id string) (backPaths []string, err error)

func (*Remote) FindById

func (r *Remote) FindById(id string) (file *File, err error)

func (*Remote) FindByIdM added in v0.3.5

func (r *Remote) FindByIdM(id string) chan *File

func (*Remote) FindByParentId

func (r *Remote) FindByParentId(parentId string, hidden bool) chan *File

func (*Remote) FindByParentIdTrashed

func (r *Remote) FindByParentIdTrashed(parentId string, hidden bool) chan *File

func (*Remote) FindByPath

func (r *Remote) FindByPath(p string) (file *File, err error)

func (*Remote) FindByPathM added in v0.3.5

func (r *Remote) FindByPathM(p string) chan *File

func (*Remote) FindByPathShared

func (r *Remote) FindByPathShared(p string) (chan *File, error)

func (*Remote) FindByPathTrashed

func (r *Remote) FindByPathTrashed(p string) (file *File, err error)

func (*Remote) FindByPathTrashedM added in v0.3.5

func (r *Remote) FindByPathTrashedM(p string) chan *File

func (*Remote) FindMatches

func (r *Remote) FindMatches(mq *matchQuery) (chan *File, error)

func (*Remote) FindStarred added in v0.3.3

func (r *Remote) FindStarred(trashed, hidden bool) (chan *File, error)

func (*Remote) Publish

func (r *Remote) Publish(id string) (string, error)

func (*Remote) Touch

func (r *Remote) Touch(id string) (*File, error)

func (*Remote) Trash

func (r *Remote) Trash(id string) error

func (*Remote) Unpublish

func (r *Remote) Unpublish(id string) error

func (*Remote) Untrash

func (r *Remote) Untrash(id string) error

func (*Remote) UpsertByComparison

func (r *Remote) UpsertByComparison(args *upsertOpt) (f *File, err error)

type Role

type Role int
const (
	UnknownRole Role = 1 << iota
	Owner
	Reader
	Writer
	Commenter
)

func (*Role) String

func (r *Role) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL