-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: initium project type flag #101
Conversation
The logic works as expected, we might improve the error message in the second case ➜ initium-cli git:(chore/issue-100) go run main.go init config
app-name: initium-cli
container-registry: ghcr.io/nearform
default-branch: main
dockerfile-name: null
env-var-file: .env.initium
image-pull-secrets: null
project-type: go
runtime-version: null
➜ initium-cli git:(chore/issue-100) touch package.json
➜ initium-cli git:(chore/issue-100) ✗ go run main.go init config
2023/10/19 10:23:33 FATA required flags "project-type" not set
exit status 1 |
src/services/project/project.go
Outdated
var projectType ProjectType | ||
var err error | ||
if proj.Type != "" { | ||
projectType, err = proj.matchType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the IsValidProjectType here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 120 or 121?
Because the function only returns a bool that indicates whether the project type is valid or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Luca Lanziani <[email protected]>
Closes #100.
Testing
This should detect the project type and store it on the initium config file. From that moment on, any initium-cli command will work without the need of specifying the project type.
If the CLI doesn't detect the type, the command will fail and the project type will be a required flag / environment variable.