Skip to content

feat(drive): add list command #62

@rianjs

Description

@rianjs

Summary

Add gro drive list command to list files in Google Drive root or a specific folder.

Usage

gro drive list                    # List files in root
gro drive list <folder-id>        # List files in folder
gro drive list --type document    # Filter by type
gro drive list --max 50           # Limit results
gro drive list --json             # JSON output

Flags

Flag Short Default Description
--max -m 25 Maximum results to return
--type -t - Filter by type (document, spreadsheet, presentation, folder, pdf, image, video, audio)
--json -j false Output as JSON

Implementation

Files to Create/Modify

  • internal/cmd/drive/list.go - List command implementation
  • internal/cmd/drive/list_test.go - Unit tests
  • internal/cmd/drive/drive.go - Register list subcommand
  • internal/drive/files.go - Add ListFiles() method if not complete

Drive API Query

// List files in root (not in trash)
q := "'root' in parents and trashed = false"

// List files in specific folder
q := "'<folder-id>' in parents and trashed = false"

// Filter by MIME type
q += " and mimeType = 'application/vnd.google-apps.document'"

MIME Type Mapping

Type Flag MIME Type
document application/vnd.google-apps.document
spreadsheet application/vnd.google-apps.spreadsheet
presentation application/vnd.google-apps.presentation
folder application/vnd.google-apps.folder
pdf application/pdf
image image/* (startsWith)

Text Output Format

ID              NAME                    TYPE         SIZE      MODIFIED
1abc2def3gh     Q4 Budget Report        Document     -         2024-01-15
4ijk5lmn6op     Financial Data          Spreadsheet  -         2024-01-14
7qrs8tuv9wx     Company Logo.png        Image        245 KB    2024-01-10

Acceptance Criteria

  • Lists files in root by default
  • Lists files in specific folder when folder-id provided
  • Filters by type correctly
  • Respects max results limit
  • JSON output works
  • make verify passes

Blocked By

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions