Summary
Add support for Google Shared Drives (formerly Team Drives) with ergonomic defaults. This is Phase 2 of shared drive support (depends on #84).
Motivation
Currently gro drive only searches/lists files in "My Drive". Many users have access to shared drives that contain important files. The CLI should search everywhere by default, with options to narrow scope.
Design
Default Behavior Change
search and list will search all drives by default (My Drive + shared drives)
- This is a breaking change from current My Drive-only behavior
New Flags
--my-drive Limit to My Drive only
--drive <name-id> Search in specific shared drive (name or ID)
These flags are mutually exclusive.
New Command
gro drive drives # List available shared drives
gro drive drives --json # JSON output
gro drive drives --refresh # Force cache refresh
Drive Name Resolution
API Requirements
| Parameter |
Purpose |
supportsAllDrives=true |
Must be in ALL requests |
includeItemsFromAllDrives=true |
Include shared drive results |
corpora |
"user", "drive", or "allDrives" |
driveId |
Required when corpora="drive" |
No additional OAuth scopes needed - drive.readonly covers shared drives.
Files to Create/Modify
| File |
Changes |
internal/drive/files.go |
Add SharedDrive, DriveScope types |
internal/drive/interfaces.go |
Add new interface methods |
internal/drive/client.go |
Implement shared drive methods |
internal/cmd/drive/drives.go |
NEW - list shared drives |
internal/cmd/drive/list.go |
Add --my-drive, --drive flags |
internal/cmd/drive/search.go |
Add --my-drive, --drive flags |
internal/cmd/drive/tree.go |
Add --my-drive, --drive flags |
internal/cmd/drive/get.go |
Add SupportsAllDrives(true) |
internal/cmd/drive/download.go |
Add SupportsAllDrives(true) |
internal/cmd/drive/output.go |
Add resolveDriveScope() helper |
README.md |
Document shared drive commands |
Example Usage
# List available shared drives
gro drive drives
# Search everywhere (new default)
gro drive search "quarterly report"
# Search only My Drive
gro drive search "quarterly report" --my-drive
# Search specific shared drive by name
gro drive search "budget" --drive "Finance Team"
# List files in shared drive
gro drive list --drive "Engineering"
Behavior Summary
| Command |
Current |
New Default |
--my-drive |
--drive "X" |
list |
My Drive |
All drives |
My Drive |
Shared drive X |
search |
My Drive |
All drives |
My Drive |
Shared drive X |
tree |
My Drive |
All drives |
My Drive |
Shared drive X |
get |
My Drive |
All drives |
N/A |
N/A |
download |
My Drive |
All drives |
N/A |
N/A |
Summary
Add support for Google Shared Drives (formerly Team Drives) with ergonomic defaults. This is Phase 2 of shared drive support (depends on #84).
Motivation
Currently
gro driveonly searches/lists files in "My Drive". Many users have access to shared drives that contain important files. The CLI should search everywhere by default, with options to narrow scope.Design
Default Behavior Change
searchandlistwill search all drives by default (My Drive + shared drives)New Flags
These flags are mutually exclusive.
New Command
Drive Name Resolution
API Requirements
supportsAllDrives=trueincludeItemsFromAllDrives=truecorpora"user","drive", or"allDrives"driveIdcorpora="drive"No additional OAuth scopes needed -
drive.readonlycovers shared drives.Files to Create/Modify
internal/drive/files.goSharedDrive,DriveScopetypesinternal/drive/interfaces.gointernal/drive/client.gointernal/cmd/drive/drives.gointernal/cmd/drive/list.go--my-drive,--driveflagsinternal/cmd/drive/search.go--my-drive,--driveflagsinternal/cmd/drive/tree.go--my-drive,--driveflagsinternal/cmd/drive/get.goSupportsAllDrives(true)internal/cmd/drive/download.goSupportsAllDrives(true)internal/cmd/drive/output.goresolveDriveScope()helperREADME.mdExample Usage
Behavior Summary
--my-drive--drive "X"listsearchtreegetdownload