From 244e1a5a7aeca35b57ba7ebcd74673667df8cb41 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Fri, 25 Jan 2019 18:39:44 +0100 Subject: [PATCH] add output when creating webhooks with the CLI (#10139) * add output when creating webhooks with the CLI * update per feedback * update per feedback --- cmd/mattermost/commands/webhook.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/mattermost/commands/webhook.go b/cmd/mattermost/commands/webhook.go index 62b245aa09..ea15b8fba6 100644 --- a/cmd/mattermost/commands/webhook.go +++ b/cmd/mattermost/commands/webhook.go @@ -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 }