Skip to content

Add --all flag to tenants list command for cross-connection view#3

Merged
paulmeller merged 1 commit intomainfrom
claude/cross-connection-tenant-visibility-W96ho
Mar 18, 2026
Merged

Add --all flag to tenants list command for cross-connection view#3
paulmeller merged 1 commit intomainfrom
claude/cross-connection-tenant-visibility-W96ho

Conversation

@paulmeller
Copy link
Copy Markdown
Owner

Summary

Added support for listing tenants across all configured connections with a new --all flag to the tenants list command. This allows users to view all tenants from every connection in a single operation, with clear indication of which connection each tenant belongs to and which is currently active.

Key Changes

  • Added --all boolean flag to the tenants list command (defaults to false)
  • Refactored newTenantsListCmd to check for the --all flag and delegate to a new helper function when enabled
  • Implemented listTenantsAllConnections function that:
    • Iterates through all configured connections
    • Loads authentication tokens for each connection
    • Fetches tenants from each connection's API
    • Gracefully skips connections that are not authenticated or fail
    • Enriches tenant data with _connection field to identify the source connection
    • Marks the currently active tenant with an _active indicator
    • Supports both JSON and table output formats
  • Reordered initialization logic in the original command to improve clarity (format and config loaded earlier)

Notable Implementation Details

  • The function gracefully handles missing or unauthenticated connections by logging to stderr and continuing
  • Each tenant object is enriched with metadata (_connection and _active fields) for better visibility
  • Output includes a new "CONNECTION" column in table format to show which connection each tenant belongs to
  • The active tenant is marked with an asterisk (*) in the _active column
  • Maintains backward compatibility - existing tenants list behavior unchanged when --all flag is not used

https://claude.ai/code/session_01XjeycZe9jRCj5wZXCFCvpm

Users can now run `xero tenants list --all` to see tenants from every
configured connection in a single table. Each row includes a CONNECTION
column showing which connection the tenant belongs to. Connections that
are not authenticated are skipped with a warning on stderr.

https://claude.ai/code/session_01XjeycZe9jRCj5wZXCFCvpm
@paulmeller paulmeller merged commit e1f8896 into main Mar 18, 2026
1 check 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.

2 participants