Skip to content

Commit

Permalink
fix: Exit with code different than 0 when error
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreZiviani committed Jan 11, 2023
1 parent 7e3dc99 commit 0895e38
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion cmd/aws-fuzzy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ package main

import (
"github.com/AndreZiviani/aws-fuzzy/internal/cli"
"os"
)

func main() {
cli.Run()
if cli.Run() != nil {
os.Exit(1)
}
}
2 changes: 1 addition & 1 deletion internal/awsprofile/aws_fuzzy_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (p *Profiles) ParseCustomSSOProfile(ctx context.Context, profile *Profile)
// New profile with SSO Session
s, ok := p.sessions[item.Value()]
if ok == false {
return nil, err
return nil, fmt.Errorf("Could not find a session named %s in profile %s\n", item.Value(), profile.Name)
}
err = s.init(ctx)
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ var (
Parser = flags.NewParser(nil, flags.Default)
)

func Run() {
func Run() error {
ssh.Init(Parser)
config.Init(Parser)
chart.Init(Parser)
sso.Init(Parser)
ssm.Init(Parser)
version.Init(Parser)
Parser.Parse()
_, err := Parser.Parse()
return err
}

0 comments on commit 0895e38

Please sign in to comment.