Skip to content

Commit

Permalink
feat: update social discord and twitter commands
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasbhat0 committed Dec 5, 2023
1 parent ffd1e02 commit 44ee238
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
20 changes: 19 additions & 1 deletion cli/cmd/social/discord.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package social

import (
"fmt"

"github.com/hugobyte/dive-core/cli/common"
"github.com/spf13/cobra"
)
Expand All @@ -13,4 +15,20 @@ var DiscordCmd = common.NewDiveCommandBuilder().
SetLong(`The command opens the Discord channel for DIVE, providing a direct link or launching the Discord application to access the dedicated DIVE community. It allows users to engage in discussions, seek support, share insights, and collaborate with other members of the DIVE community within the Discord platform.`).
SetRun(discord).Build()

func discord(cmd *cobra.Command, args []string) {}
func discord(cmd *cobra.Command, args []string) {

cli := common.GetCli()

cli.Logger().SetOutputToStdout()
err := common.ValidateArgs(args)

if err != nil {
cli.Logger().Error(common.CodeOf(err), common.Errorc(common.CodeOf(err), fmt.Sprintf("error %s \n %s ", err, cmd.UsageString())).Error())
}

cli.Logger().Info("Redirecting to DIVE discord channel...")

if err := common.OpenFile(diveURL); err != nil {
cli.Logger().Fatalf(common.CodeOf(err), "Failed to open Dive discord channel with error %v", err)
}
}
20 changes: 19 additions & 1 deletion cli/cmd/social/twitter.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package social

import (
"fmt"

"github.com/hugobyte/dive-core/cli/common"
"github.com/spf13/cobra"
)
Expand All @@ -16,4 +18,20 @@ community, and follow our social media presence directly from the Twitter homepa
).
SetRun(twitter).Build()

func twitter(cmd *cobra.Command, args []string) {}
func twitter(cmd *cobra.Command, args []string) {

cli := common.GetCli()

cli.Logger().SetOutputToStdout()
err := common.ValidateArgs(args)

if err != nil {
cli.Logger().Error(common.CodeOf(err), common.Errorc(common.CodeOf(err), fmt.Sprintf("error %s \n %s ", err, cmd.UsageString())).Error())
}

cli.Logger().Info("Redirecting to twitter...")

if err := common.OpenFile(twitterURL); err != nil {
cli.Logger().Fatalf(common.CodeOf(err), "Failed to open HugoByte twitter with error %v", err)
}
}

0 comments on commit 44ee238

Please sign in to comment.