Skip to content

Commit

Permalink
Fix CLI usage text, fix global parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
daaru00 committed Mar 1, 2021
1 parent 649ed14 commit 6dca684
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ func main() {
app := &cli.App{
Name: "bb-aws-connect",
Description: "Bitbull AWS Connect CLI",
Usage: "Connect to AWS resources (EC2 Instances and ECS Tasks) using SSM Session",
UsageText: "bb-aws-connect [global options] command [command options] [arguments...]",
Version: "VERSION", // this will be overridden during build phase
Commands: cmds,
Flags: append(globalFlags,
Expand All @@ -75,6 +77,15 @@ func main() {
Usage: "Config file path",
}),
Before: func(c *cli.Context) error {
// Set global options to sub commands
if len(c.String("profile")) > 0 {
os.Setenv("AWS_PROFILE", c.String("profile"))
}
if len(c.String("region")) > 0 {
os.Setenv("AWS_REGION", c.String("region"))
}

// Set new working directory
newCwd := c.String("root")
if newCwd != "" && newCwd != cwd {
err := os.Chdir(newCwd)
Expand Down

0 comments on commit 6dca684

Please sign in to comment.