Skip to content

Commit

Permalink
Add -n flag for get to skip trailing newline (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert DiMartino authored May 19, 2020
1 parent 55c7346 commit 3b505eb
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ import (
)

var (
Secrets = false
Profile = ""
Secrets = false
Profile = ""
NoNewLine = false
)

func main() {
app := cli.NewApp()
app.Version = "1.0.0"
app.Version = "1.1.0"
app.Usage = "simple ssm param store interface"
app.Flags = []cli.Flag{
cli.StringFlag{
Expand Down Expand Up @@ -69,6 +70,13 @@ func main() {
{
Name: "get",
Usage: "prints plaintext ssm value. ex: ssm get /app/prod/my-key",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "n",
Usage: "Do not print a trailing newline",
Destination: &NoNewLine,
},
},
Action: func(c *cli.Context) error {
if Profile != "" {
os.Setenv("AWS_PROFILE", Profile)
Expand All @@ -78,7 +86,11 @@ func main() {
if err != nil {
return err
}
fmt.Println(val)
if NoNewLine {
fmt.Print(val)
} else {
fmt.Println(val)
}
return nil
},
},
Expand Down

0 comments on commit 3b505eb

Please sign in to comment.