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

Fix bug when no unmanaged args were given #59

Merged
merged 5 commits into from
May 2, 2019

Conversation

julienduchesne
Copy link
Contributor

Reworked the CLI arguments structure. Some were function specific, some were global, it was weird. Now all are global and contained within a class. Ideally, it wouldn't be global and it would be passed around but that would require too many modifications for now. Maybe another time.

Also added tests for the CLI argument parsing logic + aliases

Also added tests for the CLI argument parsing logic + aliases
@@ -297,6 +147,3 @@ func validateVersion(version string) bool {

func printError(format string, args ...interface{}) { ErrPrintln(errorString(format, args...)) }
func printWarning(format string, args ...interface{}) { ErrPrintln(warningString(format, args...)) }

var warningString = color.New(color.FgYellow).SprintfFunc()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved up with the other vars

link := color.New(color.FgHiBlue, color.Italic).SprintfFunc()
bold := color.New(color.Bold).SprintfFunc()

descriptionTemplate.Execute(&descriptionBuffer, map[string]interface{}{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to cli.go


// Environment variables
const (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to cli.go

arguments.go Outdated
@@ -1,120 +0,0 @@
package main
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to cli.go

go.mod Outdated
@@ -12,7 +12,7 @@ require (
github.com/aws/aws-sdk-go v1.16.12
github.com/blang/semver v0.0.0-20180723201105-3c1074078d32
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 // indirect
github.com/coveo/gotemplate v2.7.6+incompatible // indirect
github.com/coveo/gotemplate v2.7.6+incompatible
Copy link
Contributor

Choose a reason for hiding this comment

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

Not supposed to be here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gotemplate or this modification?

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, it is because terragrunt is not still updated to go modules

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean the v2.7.6+incompatible ...

@coveralls
Copy link

coveralls commented May 1, 2019

Pull Request Test Coverage Report for Build 782

  • 101 of 145 (69.66%) changed or added relevant lines in 5 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+16.2%) to 33.721%

Changes Missing Coverage Covered Lines Changed/Added Lines %
application.go 13 14 92.86%
cli.go 85 87 97.7%
docker.go 1 18 5.56%
main.go 0 24 0.0%
Files with Coverage Reduction New Missed Lines %
main.go 5 0.0%
Totals Coverage Status
Change from base Build 772: 16.2%
Covered Lines: 319
Relevant Lines: 946

💛 - Coveralls

jocgir
jocgir previously approved these changes May 1, 2019
jocgir
jocgir previously approved these changes May 1, 2019
Copy link
Contributor

@jocgir jocgir left a comment

Choose a reason for hiding this comment

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

I did some refactoring on your refactoring

cli.go Outdated
@@ -240,20 +244,20 @@ func (app *ApplicationArguments) parseArguments() (*CliOptions, []string) {
if extraArgs, ok := os.LookupEnv(envArgs); ok {
os.Args = append(os.Args, strings.Split(extraArgs, " ")...)
}
managed, unmanaged := app.SplitManaged(os.Args)
must(app.Parse(managed))
app.managedArgs, app.unmanagedArgs = app.SplitManaged(os.Args)
Copy link
Contributor

Choose a reason for hiding this comment

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

The SplitManaged should then modify directly the parameters.

You should instead override the Parse method. I'll do it in your branch.

@julienduchesne
Copy link
Contributor Author

Nice! Ready to merge?

@jocgir
Copy link
Contributor

jocgir commented May 2, 2019

It is up to you now.

@julienduchesne
Copy link
Contributor Author

I'll merge it but not release 1.20.0 now. I may have some other fixes to do. My functional tests are still not working, but I'm making progress

@julienduchesne julienduchesne merged commit f178752 into master May 2, 2019
@julienduchesne julienduchesne deleted the fix-unmanaged-bug branch May 2, 2019 11:25
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.

None yet

3 participants