add output when creating webhooks with the CLI (#10139)

* add output when creating webhooks with the CLI

* update per feedback

* update per feedback
This commit is contained in:
Carlos Tadeu Panato Junior
2019-01-25 18:39:44 +01:00
committed by Christopher Speller
parent 6d733e35f7
commit 244e1a5a7a

View File

@@ -156,10 +156,14 @@ func createIncomingWebhookCmdF(command *cobra.Command, args []string) error {
ChannelLocked: channelLocked,
}
if _, err := app.CreateIncomingWebhookForChannel(user.Id, channel, incomingWebhook); err != nil {
return err
createdIncoming, errIncomingWebhook := app.CreateIncomingWebhookForChannel(user.Id, channel, incomingWebhook)
if errIncomingWebhook != nil {
return errIncomingWebhook
}
CommandPrettyPrintln("Id: " + createdIncoming.Id)
CommandPrettyPrintln("Display Name: " + createdIncoming.DisplayName)
return nil
}
@@ -287,10 +291,14 @@ func createOutgoingWebhookCmdF(command *cobra.Command, args []string) error {
}
}
if _, err := app.CreateOutgoingWebhook(outgoingWebhook); err != nil {
return err
createdOutgoing, errOutgoing := app.CreateOutgoingWebhook(outgoingWebhook)
if errOutgoing != nil {
return errOutgoing
}
CommandPrettyPrintln("Id: " + createdOutgoing.Id)
CommandPrettyPrintln("Display Name: " + createdOutgoing.DisplayName)
return nil
}