Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
  • Loading branch information
nyagamunene committed Jan 14, 2025
1 parent 97c1732 commit 693cfed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ func logErrorCmd(cmd cobra.Command, err error) {
func logOKCmd(cmd cobra.Command) {
fmt.Fprintf(cmd.OutOrStdout(), "\n%s\n\n", color.BlueString("ok"))
}

func logSuccessCmd(cmd cobra.Command, msg string) {
fmt.Fprintf(cmd.OutOrStdout(), "\n%s\n", color.GreenString(msg))
}
7 changes: 7 additions & 0 deletions cli/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var provisionCmd = &cobra.Command{
logErrorCmd(*cmd, errors.Wrap(errFailedToCreateToken, err))
return
}
logSuccessCmd(*cmd, "Successfully created access token")

domain := smqSDK.Domain{
Name: "demo",
Expand All @@ -58,6 +59,7 @@ var provisionCmd = &cobra.Command{
logErrorCmd(*cmd, errors.Wrap(errFailedToCreateDomain, err))
return
}
logSuccessCmd(*cmd, "Successfully created domain")

managerThing := smqSDK.Client{
Name: "Propeller Manager",
Expand All @@ -70,6 +72,7 @@ var provisionCmd = &cobra.Command{
logErrorCmd(*cmd, errors.Wrap(errFailedClientCreation, err))
return
}
logSuccessCmd(*cmd, "Successfully created manager client")

propletThing := smqSDK.Client{
Name: "Propeller Proplet",
Expand All @@ -82,6 +85,7 @@ var provisionCmd = &cobra.Command{
logErrorCmd(*cmd, errors.Wrap(errFailedClientCreation, err))
return
}
logSuccessCmd(*cmd, "Successfully created proplet client")

managerChannel := smqSDK.Channel{
Name: "Propeller Manager",
Expand All @@ -92,6 +96,7 @@ var provisionCmd = &cobra.Command{
logErrorCmd(*cmd, errors.Wrap(errFailedChannelCreation, err))
return
}
logSuccessCmd(*cmd, "Successfully created manager channel")

conns := smqSDK.Connection{
ClientIDs: []string{
Expand All @@ -111,6 +116,7 @@ var provisionCmd = &cobra.Command{
logErrorCmd(*cmd, errors.Wrap(errFailedConnectionCreation, err))
return
}
logSuccessCmd(*cmd, "Successfully created connections")

res := Result{
ManagerThing: managerThing,
Expand Down Expand Up @@ -151,6 +157,7 @@ channel_id = "%s"`,
logErrorCmd(*cmd, errors.New("failed to create config file"))
return
}
logSuccessCmd(*cmd, "Successfully created config file")

logJSONCmd(*cmd, res)
},
Expand Down
Binary file removed propeller-cli
Binary file not shown.

0 comments on commit 693cfed

Please sign in to comment.