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

refactor: restructure organization commands #332

Merged
merged 14 commits into from
Jun 4, 2024

Conversation

CGoodwin90
Copy link
Contributor

@CGoodwin90 CGoodwin90 commented Mar 25, 2024

Checklist

  • Affected Issues have been mentioned in the Closing issues section
  • Documentation has been written/updated.
  • Changelog entry has been written

Moves organization subcommands to the top level, prefixes a number of cmds with 'organization-' & allows projects & groups to be created in an organization via the --organization-name flag in the current addProject/addGroup commands. Rewrites a few of the legacy commands to utilize machinery.

E.g.

Current PR
lagoon add organization organization --name lagoon add organization --organization-name
lagoon add organization deploytarget lagoon add organization-deploytarget
lagoon add organization project lagoon add project --organization-name etc

@shreddedbacon
Copy link
Member

You'll need to tidy up the docs directory. There are references to the old commands still: https://github.com/uselagoon/lagoon-cli/blob/remove-org-subcommands/docs/commands/lagoon_add_organization_deploytarget.md (plus others)

Unfortunately the docs command doesn't clean this up for you. The simple solution is to just delete anything in the commands directory then re-run the docs generator so that it creates all the commands again.

Copy link
Member

@shreddedbacon shreddedbacon left a comment

Choose a reason for hiding this comment

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

Will need updates based on latest merges to main, and also the documentation fixes.

cmd/list.go Outdated Show resolved Hide resolved
cmd/users.go Outdated Show resolved Hide resolved
cmd/deploytarget.go Outdated Show resolved Hide resolved
cmd/groups.go Outdated Show resolved Hide resolved
Copy link
Member

@shreddedbacon shreddedbacon left a comment

Choose a reason for hiding this comment

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

Added some comments and such around some things, if you're not sure about something though, ask

@shreddedbacon shreddedbacon changed the title Change: Removes organization subcommands refactor: restructure organization commands Apr 11, 2024
@shreddedbacon
Copy link
Member

Sorry to hijack the PR a bit just then. I saw a few things that I just went and fixed up.

I'll do a proper run through with this today and see if it is all good though

cmd/groups.go Outdated Show resolved Hide resolved
cmd/deploytarget.go Outdated Show resolved Hide resolved

deleteDeployTargetCmd.Flags().UintP("id", "", 0, "ID of the DeployTarget")
deleteDeployTargetCmd.Flags().StringP("name", "", "", "Name of DeployTarget")

RemoveDeployTargetFromOrganizationCmd.Flags().StringP("name", "O", "", "Name of Organization")
RemoveDeployTargetFromOrganizationCmd.Flags().UintP("deploy-target", "D", 0, "ID of DeployTarget")
removeDeployTargetFromOrganizationCmd.Flags().StringP("name", "O", "", "Name of Organization")
Copy link
Member

Choose a reason for hiding this comment

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

Can we change this to organization to match other flags in other commands. There may be other organization commands that use name, but if they can be updated to be organization that'd be wicked. That way there is no confusion across the flagset for organizations.

It was initially confusing to me when i went to use --name in one place (lagoon list organization-users --organization ${orgname}) only to find it was --organization and then vice versa when using a different command (lagoon delete organization-deploytarget --name ${orgname}).

Copy link
Member

Choose a reason for hiding this comment

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

I think the only one that should be --name is maybe add organization.

Alternatively, if the flag is changed to organization-name then we cover all possibly cases on all commands

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I've changed the flag to organization-name.

@shreddedbacon shreddedbacon merged commit a13b6b9 into main Jun 4, 2024
4 checks passed
@shreddedbacon shreddedbacon deleted the remove-org-subcommands branch June 4, 2024 23:19
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