Skip to content

Commit

Permalink
Merge pull request #16 from fujiwara/fix-options
Browse files Browse the repository at this point in the history
fix handling for empty global options.
  • Loading branch information
fujiwara authored Apr 7, 2020
2 parents 8ba14e6 + 74b279a commit 6c5bf7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions cmd/lambroll/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func _main() int {
}

command := kingpin.Parse()
if command == "version" {
fmt.Println("lambroll", Version)
return 0
}

filter := &logutils.LevelFilter{
Levels: []logutils.LogLevel{"trace", "debug", "info", "warn", "error"},
Expand All @@ -96,10 +100,6 @@ func _main() int {
log.Println("[error]", err)
return 1
}
if command == "version" {
fmt.Println("lambroll", Version)
return 0
}

log.Println("[info] lambroll", Version)
switch command {
Expand Down
6 changes: 3 additions & 3 deletions lambroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ type App struct {
// New creates an application
func New(opt *Option) (*App, error) {
awsCfg := &aws.Config{}
if opt.Region != nil {
if opt.Region != nil && *opt.Region != "" {
awsCfg.Region = aws.String(*opt.Region)
}
sessOpt := session.Options{Config: *awsCfg}
var profile string
if opt.Profile != nil {
if opt.Profile != nil && *opt.Profile != "" {
sessOpt.Profile = *opt.Profile
profile = *opt.Profile
}
sess := session.Must(session.NewSessionWithOptions(sessOpt))

loader := config.New()
if opt.TFState != nil {
if opt.TFState != nil && *opt.TFState != "" {
funcs, err := tfstate.Load(*opt.TFState)
if err != nil {
return nil, err
Expand Down

0 comments on commit 6c5bf7f

Please sign in to comment.