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

Typesafety for framework and driver flags #89

Merged
merged 17 commits into from
Nov 21, 2023

Conversation

MitchellBerend
Copy link
Contributor

@MitchellBerend MitchellBerend commented Nov 12, 2023

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

Problem/Feature

Currently the framework and driver flags is passed as a string that can contain any value. The value of this flag is then manually validated and compared to hard coded values.

Description of Changes:

Converted the framework driver flags to use a struct to ensure the content is valid throughout the code base. This creates a single place to add or change framework options. It also adds constants to compare values against.

This is a continuation of #61, this pr adds a type alias Framework that only allows for certain values to be passed as a flag.

Checklist

  • I have self-reviewed the changes being requested
    - [ ] I have updated the documentation (if applicable) (Not applicable)

@MitchellBerend MitchellBerend marked this pull request as ready for review November 12, 2023 20:28
@MitchellBerend MitchellBerend force-pushed the feature/type-safety branch 2 times, most recently from 7c00e4b to d658fbf Compare November 14, 2023 12:11
Comment on lines 26 to 31
//
// type Value interface {
// String() string
// Set(string) error
// Type() string
// }
Copy link
Owner

Choose a reason for hiding this comment

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

Leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh woops

cmd/flags/frameworks.go Show resolved Hide resolved
@MitchellBerend MitchellBerend marked this pull request as draft November 17, 2023 07:02
@MitchellBerend MitchellBerend marked this pull request as ready for review November 17, 2023 07:10
@MitchellBerend MitchellBerend marked this pull request as draft November 17, 2023 17:42
@MitchellBerend MitchellBerend changed the title Typesafety for framework flag Typesafety for framework and driver flags Nov 18, 2023
@MitchellBerend MitchellBerend marked this pull request as ready for review November 18, 2023 08:56
cmd/create.go Show resolved Hide resolved
Copy link
Owner

@Melkeydev Melkeydev left a comment

Choose a reason for hiding this comment

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

LGTM

@Melkeydev Melkeydev merged commit b471b4d into Melkeydev:main Nov 21, 2023
37 checks passed
SudoSurya pushed a commit to SudoSurya/go-blueprint that referenced this pull request Nov 24, 2023
* Converted the framework flag to use a struct to ensure the content is valid throughout the codebase

* Changed frameworks dir to flags

* Added missing files

* Updated comments

* Removed stray comment

* Updated Set function for Framework

* Removed Contains check since it's not available yet

* Fixed merge issues

* Fixed more merge issues

* Casting �options.ProjectType to flags.Framework

* Fixed even more merge issues

* Extended type safety to driver flag

* Removed unused global var

* Ran gofmt

* Ran more gofmt

* Replaced db hard coded strings with constants

* Replaced strings with constants
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