Documentation ¶
Index ¶
- Constants
- Variables
- func NonEmptyStrings(v []string) (splits []string)
- func PrintVersion()
- func RetrieveRefreshToken(context *config.Context) (string, error)
- func ShowAllDescriptions()
- func ShowDescription(topic string)
- type AccountType
- type ByPrecedence
- type Change
- type Commands
- func (g *Commands) About(mask int) (err error)
- func (g *Commands) Copy() error
- func (g *Commands) Diff() (err error)
- func (g *Commands) EmptyTrash() error
- func (g *Commands) Init() (err error)
- func (g *Commands) List() (err error)
- func (g *Commands) ListMatches() error
- func (g *Commands) Move() (err error)
- func (c *Commands) Publish() (err error)
- func (g *Commands) Pull() (err error)
- func (g *Commands) PullMatches() (err error)
- func (g *Commands) PullPiped() (err error)
- func (g *Commands) Push() (err error)
- func (g *Commands) PushPiped() (err error)
- func (g *Commands) QuotaStatus(query int64) (status int, err error)
- func (g *Commands) Rename() error
- func (c *Commands) Share() (err error)
- func (g *Commands) Stat() error
- func (g *Commands) Touch() (err error)
- func (g *Commands) TouchByMatch() (err error)
- func (g *Commands) Trash() (err error)
- func (g *Commands) TrashByMatch() error
- func (c *Commands) Unpublish() error
- func (c *Commands) Unshare() (err error)
- func (g *Commands) Untrash() (err error)
- func (g *Commands) UntrashByMatch() error
- type File
- type Operation
- type Options
- type Remote
- func (r *Remote) About() (about *drive.About, err error)
- func (r *Remote) Download(id string, exportURL string) (io.ReadCloser, error)
- func (r *Remote) EmptyTrash() error
- func (r *Remote) FindById(id string) (file *File, err error)
- func (r *Remote) FindByParentId(parentId string, hidden bool) chan *File
- func (r *Remote) FindByParentIdTrashed(parentId string, hidden bool) chan *File
- func (r *Remote) FindByPath(p string) (file *File, err error)
- func (r *Remote) FindByPathShared(p string) (chan *File, error)
- func (r *Remote) FindByPathTrashed(p string) (file *File, err error)
- func (r *Remote) FindMatches(dirPath string, keywords []string, inTrash bool) (chan *File, error)
- func (r *Remote) Publish(id string) (string, 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 Role
Constants ¶
View Source
const ( Barely = iota AlmostExceeded HalfwayExceeded Exceeded Unknown )
View Source
const ( AboutNone = 1 << iota AboutQuota AboutFileSizes AboutFeatures )
View Source
const ( SelectSrc = 1 << iota SelectDest )
View Source
const ( AboutKey = "about" AllKey = "all" CopyKey = "copy" DiffKey = "diff" EmptyTrashKey = "emptytrash" FeaturesKey = "features" HelpKey = "help" InitKey = "init" LinkKey = "Link" ListKey = "list" MoveKey = "move" OSLinuxKey = "linux" PullKey = "pull" PushKey = "push" PubKey = "pub" RenameKey = "rename" QuotaKey = "quota" StatKey = "stat" TouchKey = "touch" TrashKey = "trash" UntrashKey = "untrash" UnpubKey = "unpub" VersionKey = "version" ForceKey = "force" QuietKey = "quiet" QuitShortKey = "q" QuitLongKey = "quit" DriveRepoRelPath = "github.com/odeke-em/drive" )
View Source
const ( DescAbout = "print out information about your Google drive" DescAll = "print out the entire help section" DescCopy = "copy remote paths to a destination" DescDiff = "compares local files with their remote equivalent" DescEmptyTrash = "permanently cleans out your trash" DescFeatures = "returns information about the features of your drive" DescHelp = "Get help for a topic" DescInit = "initializes a directory and authenticates user" DescList = "lists the contents of remote path" DescMove = "move files/folders" 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" DescPush = "push local changes to Google Drive" 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" 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." 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" )
View Source
const ( CLIOptionIgnoreChecksum = "ignore-checksum" CLIOptionIgnoreConflict = "ignore-conflict" )
View Source
const ( InTrash = 1 << iota Folder NonFolder Minimal Owners CurrentVersion )
View Source
const ( MimeTypeJoiner = "-" RemoteDriveRootPath = "My Drive" )
View Source
const ( // Google OAuth 2.0 service URLs GoogleOAuth2AuthURL = "https://accounts.google.com/o/oauth2/auth" GoogleOAuth2TokenURL = "https://accounts.google.com/o/oauth2/token" // 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/" )
View Source
const ( OptNone = 1 << iota OptConvert OptOCR OptUpdateViewedDate OptContentAsIndexableText OptPinned OptNewRevision )
View Source
const ( UnknownAccountType = 1 << iota Anyone User Domain Group )
View Source
const ( UnknownRole = 1 << iota Owner Reader Writer Commenter )
View Source
const ( Notify )
View Source
const ( OpNone = iota OpAdd OpDelete OpMod OpModConflict )
View Source
const ( DifferNone = 0 DifferDirType = 1 << iota DifferMd5Checksum DifferModTime DifferSize )
View Source
const (
DriveFolderMimeType = "application/vnd.google-apps.folder"
)
View Source
const (
DriveIgnoreSuffix = ".driveignore"
)
View Source
const MaxFileSize = 50 * 1024 * 1024
MaxFileSize is the max number of bytes we can accept for diffing (Arbitrary value)
View Source
const Version = "0.1.7"
Variables ¶
View Source
var ( UnescapedPathSep = fmt.Sprintf("%c", os.PathSeparator) EscapedPathSep = url.QueryEscape(UnescapedPathSep) )
View Source
var Aliases = map[string][]string{ CopyKey: []string{"cp"}, ListKey: []string{"ls"}, MoveKey: []string{"mv"}, }
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 (
ErrNoContext = errors.New("not in a drive context")
)
View Source
var ErrPathNotDir = errors.New("not a directory")
View Source
var (
ErrPathNotExists = errors.New("remote path doesn't exist")
)
View Source
var Ruler = strings.Repeat("*", 4)
Functions ¶
func NonEmptyStrings ¶
func PrintVersion ¶
func PrintVersion()
func ShowAllDescriptions ¶
func ShowAllDescriptions()
func ShowDescription ¶
func ShowDescription(topic string)
Types ¶
type AccountType ¶
type AccountType int
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) EmptyTrash ¶
func (*Commands) ListMatches ¶ added in v0.1.7
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) PullMatches ¶ added in v0.1.7
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 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 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 }
func NewRemoteFile ¶
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 // 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 IgnoreRegexp *regexp.Regexp // 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 }
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
func NewRemoteContext ¶
func (*Remote) EmptyTrash ¶
func (*Remote) FindByParentId ¶
func (*Remote) FindByParentIdTrashed ¶
func (*Remote) FindByPathTrashed ¶
func (*Remote) FindMatches ¶
func (*Remote) UpsertByComparison ¶
Click to show internal directories.
Click to hide internal directories.