Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce 'globus gcs' as a collection of aliases for existing commands #902

Merged
merged 5 commits into from
Dec 6, 2023

Conversation

sirosen
Copy link
Member

@sirosen sirosen commented Dec 4, 2023

This changeset introduces globus gcs with tests particularly focused on the globus gcs collection commands for now.

The changelog describes these as new commands meant to eventually replace the existing commands. No deprecation is included in the current messaging.

There are some impacts of these changes on the WrongEntityTypeError mapping of commands to "commands which should be used instead".
Not only are commands mapped to globus gcs collection instead of globus collection, but the underlying datastructure was refactored in an attempt to improve clarity.

  • Introduce gcs command as set of aliases
  • Test 'gcs' aliases for 'collection' commands
  • Refactor "should use map" for improved readability
  • Add changelog for new 'globus gcs' commands

Testing covers two elements of this:
- ensure that the aliasing produces good usage/help text
- ensure that the aliases can be used interchangably with the
  originals
To test these aliases, parametrize the tests to use 'gcs collection'
and 'collection' variants.

In order to ensure these work correctly, the "should use" mapping of
commands needed several updates to list 'globus gcs' variants. It also
was opportunistically updated at this time to list 'globus gcp'.
The "should use map" in `WrongEntityTypeError` is used to map one
command to another, e.g. redirecting `globus endpoint update` to
`globus gcp update guest`.

This enhancement rewrites it such that the source side is expected to
be multiple (rather than the destination side), which leads to a more
natural expression of the same data.

For improved comprehensibility, the mapping is now ordered at the
top-level (as a tuple) rather than containing ordered lists, and uses
a dataclass to represent the mappings.
This makes it slightly more verbose in spite of the fact that it
features slightly less repetition of data.

A very slight data change was made to list
`globus gcs collection show` rather than `globus collection show`.
src/globus_cli/endpointish/errors.py Outdated Show resolved Hide resolved
src/globus_cli/endpointish/errors.py Outdated Show resolved Hide resolved
tests/functional/collection/test_collection_delete.py Outdated Show resolved Hide resolved
tests/functional/collection/test_collection_list.py Outdated Show resolved Hide resolved
tests/functional/test_gcs_aliasing.py Outdated Show resolved Hide resolved
- ShouldUse.command is renamed to ShouldUse.dst_command
- Always write ShouldUse params in the same order
- Improvements to test parametrization

Co-authored-by: Kurt McKee <[email protected]>
@sirosen sirosen merged commit 7db9486 into globus:main Dec 6, 2023
17 checks passed
@sirosen sirosen deleted the introduce-gcs-command branch December 6, 2023 00:21
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