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

Feature: Add interface to declare aliases for legacy actions #187

Merged
merged 12 commits into from
Jun 15, 2023

Conversation

priitlatt
Copy link
Contributor

@priitlatt priitlatt commented Dec 28, 2021

At the moment there is no way to gracefully change tool namespace. For example the root namespace of app-store-connect is utterly cluttered and many of the actions could and should be grouped under relevant action groups.

For example at the moment we have action app-store-connect get-profile. But as there are a lot more profile actions, then it would make sense to create a separate action group profiles, and make the get-profile action under that as app-store-connect profiles get. Just doing a hard rename would be a breaking change that we want to avoid at all cost.

This PR adds option to add a deprecated alias via deprecated_alias parameter to @cli.action decorator. By moving forwards with the example above, with the changes from this PR we can refactor

    @cli.action('get-profile', *GetProfileArgs)
    def get_profile(...): ...

from AppStoreConnect class to ProfilesActionGroup as

@cli.action(
    'get',
    *GetProfileArgs,
    action_group=AppStoreConnectActionGroup.PROFILES,
    deprecated_alias='get-profile',
)
def get_profile(...): ...

Then both action app-store-connect get-profile and app-store-connect profiles get would do the same thing with the difference that the deprecated version does not pop up in --help messages and yields a warning message:

Using `app-store-connect get-profile` is deprecated and replaced by equivalent action `app-store-connect profiles get`.
Use `app-store-connect profiles get` instead as `app-store-connect get-profile` is subject for removal in future releases.

@priitlatt priitlatt marked this pull request as draft December 28, 2021 16:09
@priitlatt priitlatt marked this pull request as ready for review June 2, 2023 09:14
Copy link
Contributor

@artemii-yanushevskyi artemii-yanushevskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we use "legacy" and "deprecated" interchangeably, can we perhaps stick to one or the other?

@priitlatt priitlatt merged commit 2ce557b into master Jun 15, 2023
@priitlatt priitlatt deleted the feature/deprecated-action-aliases branch June 15, 2023 12:57
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