Skip to content

feat(drive): add list command#68

Merged
rianjs merged 1 commit intomainfrom
feat/62-drive-list
Jan 25, 2026
Merged

feat(drive): add list command#68
rianjs merged 1 commit intomainfrom
feat/62-drive-list

Conversation

@rianjs
Copy link
Copy Markdown
Contributor

@rianjs rianjs commented Jan 25, 2026

Summary

  • Add gro drive list command to list files in Google Drive root or specific folder
  • Support --type flag for filtering by file type (document, spreadsheet, presentation, folder, pdf, image, video, audio)
  • Support --max flag for limiting results (default 25)
  • Support --json flag for JSON output
  • Table output includes ID, name, type, size, and modified date

Test Plan

  • gro drive list --help shows usage
  • Tests for query building and type filtering
  • Tests for size formatting
  • make verify passes

Closes #62

Add `gro drive list` command to list files in Google Drive:
- List files in root or specific folder
- Filter by file type (document, spreadsheet, presentation, etc.)
- Support --max and --json flags
- Table output with ID, name, type, size, and modified date

Closes #62
@rianjs
Copy link
Copy Markdown
Contributor Author

rianjs commented Jan 25, 2026

Test Coverage Assessment

Summary

The test coverage for this PR is adequate for the scope of changes. The PR follows established patterns in the codebase and tests the critical business logic.

What is Well Tested

Query Building Logic (100% coverage)

  • buildListQuery - correctly tested for root folder, specific folder, and type filtering
  • getMimeTypeFilter - comprehensive test coverage including all 8 supported types, aliases (doc/sheet/slides), case insensitivity, and error cases
  • Tests verify the Drive API query string construction, which is the most complex logic in this command

Utility Functions (100% coverage)

  • formatSize - all size tiers tested (B, KB, MB, GB) with boundary cases
  • newListCommand - flag definitions, argument validation, and command metadata

Untested Code

Runtime execution paths (0% coverage)

  • runList - the main command execution function
  • printFileTable - table output formatting
  • printJSON / newDriveClient - shared utilities

Assessment

This is a pragmatic level of coverage. The untested code falls into two categories:

  1. OAuth/API integration code (newDriveClient, ListFiles) - This requires live credentials and is appropriately tested at the integration level, not unit tests. The codebase has a ClientFactory pattern specifically to enable mocking.

  2. I/O code (printFileTable, printJSON) - These are thin wrappers around standard library functions (tabwriter, json.Encoder). Testing these provides minimal value and this pattern is consistent with other commands in the codebase (e.g., mail/search, calendar/list).

The critical path - transforming user input (folder ID, file type) into a valid Drive API query string - has complete test coverage with edge cases (case insensitivity, type aliases, invalid types).

Potential Improvements (Optional)

If higher coverage is desired, consider:

  • Testing printFileTable output for formatting edge cases (empty size, missing modified time)
  • Testing runList with a mock client to verify the command wiring

However, this is not blocking - the tests match the existing patterns in internal/cmd/mail/ and internal/cmd/calendar/.


Reviewed by Claude Code

@rianjs rianjs merged commit 55ed967 into main Jan 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(drive): add list command

1 participant