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

Move all execution logic from the CLI to pkg #27

Closed
ianpittwood opened this issue Feb 10, 2020 · 2 comments
Closed

Move all execution logic from the CLI to pkg #27

ianpittwood opened this issue Feb 10, 2020 · 2 comments
Assignees
Labels
cli Relates to configuration or code for the CLI refactor Relates to code refactoring

Comments

@ianpittwood
Copy link
Contributor

Problem description (if applicable)
The cmd/ directory should be strictly for CLI implementation, logic, and validation. Currently, some commands have some of their execution logic written in the same file as the command declaration in the cmd/ directory. Having the execution logic mixed with the command implementation can cause confusion for developers and possible namespace collisions. Having all logic within the pkg/ directory will also make it easier to use airshipctl as a library. The following files have mixed code:

  • cmd/config/get_authinfo.go
  • cmd/config/get_cluster.go
  • cmd/config/get_context.go
  • cmd/config/set_authinfo.go
  • cmd/config/set_cluster.go
  • cmd/config/set_context.go

Proposed change
All execution logic should be moved from the cmd/ directory to the pkg/ directory.

@ianpittwood ianpittwood added cli Relates to configuration or code for the CLI refactor Relates to code refactoring labels Feb 10, 2020
@ianpittwood ianpittwood self-assigned this Feb 10, 2020
@ianpittwood ianpittwood added the wip Work in progress label Feb 10, 2020
@ianpittwood
Copy link
Contributor Author

@ianpittwood
Copy link
Contributor Author

My first PS got out of hand so I started a new one to be more targeted specifically for this issue https://review.opendev.org/#/c/707216/

@ianpittwood ianpittwood added ready for review Change related to the issue is ready for review and removed wip Work in progress labels Feb 11, 2020
airshipbot pushed a commit that referenced this issue Feb 14, 2020
Moves all execution logic from cmd/config to pkg/config.

Adds tests for moved execution logic.

Change-Id: I6381c9fe9eeba938e855bf7d7ea52cd22a5c08b6
@ianpittwood ianpittwood removed the ready for review Change related to the issue is ready for review label Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Relates to configuration or code for the CLI refactor Relates to code refactoring
Projects
None yet
Development

No branches or pull requests

1 participant