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

Improve CLI #102

Merged
merged 5 commits into from
Apr 15, 2017
Merged

Improve CLI #102

merged 5 commits into from
Apr 15, 2017

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Apr 15, 2017

Fix #99

Until now I used golang flag package, but there are many inconvenience in scenes such as error handling of options... So, use go-flags instead of flag package. This package is excellent in terms of handling of unknown option etc.

args, err := parser.ParseArgs(args)
if err != nil {
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
fmt.Fprintln(cli.outStream, err)
Copy link
Member Author

Choose a reason for hiding this comment

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

[gometalinter]

  • [gas] Errors unhandled.,LOW,HIGH

Copy link
Member Author

Choose a reason for hiding this comment

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

Umm... If it can not output to cli.outStream, can not do anything :(

fmt.Fprintln(cli.outStream, err)
return ExitCodeOK
} else {
fmt.Fprintln(cli.errStream, err)
Copy link
Member Author

Choose a reason for hiding this comment

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

[gometalinter]

  • [gas] Errors unhandled.,LOW,HIGH

@wata727 wata727 merged commit eee54a8 into master Apr 15, 2017
@wata727 wata727 deleted the fix_cli branch April 15, 2017 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant