How glotlabs/gdrive works
gdrive is a command-line client for Google Drive. Users configure or import an account, then invoke commands for file and folder operations, Drive listing, and permission management. Those command handlers obtain an authenticated Drive hub and perform API requests; file transfer also includes local tree traversal, metadata preparation, and retry-aware chunk uploads. Account management and archive export/import form a separate credential lifecycle. The graph reflects documented capabilities and relationships visible in the excerpts or source index; several unsampled handlers are represented by their exact enclosing directories.
Main entry points: upload.rs Upload and download · hub_helper.rs Hub setup · files File commands · main.rs Command dispatch
Components 21
CLI entry
- Command dispatch
src/main.rs
Account lifecycle
- Account commands
src/account - Account config
src/app_config.rs - Account archives
src/common/account_archive.rs
Drive operations
- File commands
src/files - Upload and download
src/files/upload.rs - File metadata
src/files/info.rs - Search and list
src/files/list.rs - Drive tree traversal
src/common/file_tree_drive.rs - Local tree traversal
src/common/file_tree.rs - Drive listing
src/drives/list.rs - Permission commands
src/permissions
Shared runtime
- OAuth and hub
src/hub.rs - Hub setup
src/common/hub_helper.rs - Drive file types
src/common/drive_file.rs - Permission model
src/common/permission.rs - Chunk retry support
src/common/delegate.rs - Table formatting
src/common/table.rs
Other components
- CLI user
- Google Drive API
- Local files
Connections 37
- CLI user → Command dispatch: runs commands
- Command dispatch → Account commands: dispatches account
- Command dispatch → File commands: dispatches files
- Command dispatch → Drive listing: dispatches drives
src/main.rs - Command dispatch → Permission commands: dispatches permissions
- Account commands → Account config: manages accounts
src/account/add.rs - Account commands → Account archives: imports and exports
src/account/export.rs - Account commands → OAuth and hub: starts OAuth
src/account/add.rs - Account config → Local files: persists credentials
src/app_config.rs - Hub setup → Account config: loads account
src/common/hub_helper.rs - Hub setup → OAuth and hub: creates hub
src/common/hub_helper.rs - File commands → Upload and download: dispatches transfers
src/files.rs - File commands → File metadata: dispatches metadata
src/files.rs - File commands → Search and list: dispatches listing
src/files.rs - File commands → Google Drive API: operates on
- Upload and download → Hub setup: obtains hub
src/files/upload.rs - Upload and download → File metadata: gets file details
src/files/upload.rs - Upload and download → Local tree traversal: builds upload tree
src/files/upload.rs - Upload and download → Drive tree traversal: walks remote tree
- Upload and download → Chunk retry support: configures retries
src/files/upload.rs - Upload and download → Google Drive API: transfers files
src/files/upload.rs - Upload and download → Local files: reads and writes
- File metadata → Hub setup: obtains hub
src/files/info.rs - File metadata → Google Drive API: fetches metadata
src/files/info.rs - Search and list → Hub setup: obtains hub
src/files/list.rs - Search and list → Google Drive API: queries files
src/files/list.rs - Search and list → Table formatting: formats results
src/files/list.rs - Drive tree traversal → Search and list: lists children
src/common/file_tree_drive.rs - Drive tree traversal → Google Drive API: reads remote tree
src/common/file_tree_drive.rs - Local tree traversal → Local files: scans paths
src/common/file_tree.rs - File commands → Drive file types: uses file metadata
src/common/drive_file.rs - Drive listing → Hub setup: obtains hub
src/drives/list.rs - Drive listing → Google Drive API: lists drives
- Drive listing → Table formatting: formats results
src/drives/list.rs - Permission commands → Hub setup: obtains hub
src/permissions/revoke.rs - Permission commands → Google Drive API: manages sharing
- Permission commands → Permission model: matches permissions
src/permissions/revoke.rs