generated from kurtosis-tech/package-template-repo
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement utility and social commands using builder pattern
- Loading branch information
1 parent
600bd69
commit 79a0eff
Showing
6 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/hugobyte/dive-core/cli/cmd/social" | ||
"github.com/hugobyte/dive-core/cli/cmd/utility" | ||
"github.com/hugobyte/dive-core/cli/common" | ||
"github.com/hugobyte/dive-core/cli/styles" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rootCmd = common.NewDiveCommandBuilder(). | ||
SetUse("dive"). | ||
SetShort("Deployable Infrastructure for Virtually Effortless blockchain integration"). | ||
ToggleHelpCommand(true). | ||
AddCommand(utility.CleanCmd). | ||
AddCommand(utility.TutorialCmd). | ||
AddCommand(utility.VersionCmd). | ||
AddCommand(social.DiscordCmd). | ||
AddCommand(social.TwitterCmd). | ||
AddBoolPersistentFlag(&common.DiveLogs, "verbose", false, "Prints out logs to Stdout"). | ||
SetRunE(run). | ||
Build() | ||
|
||
func run(cmd *cobra.Command, args []string) error { | ||
styles.RenderBanner() | ||
cmd.Help() | ||
|
||
return nil | ||
} | ||
|
||
func init() { | ||
common.GetDiveContext() | ||
} | ||
|
||
func Execute() { | ||
err := rootCmd.Execute() | ||
|
||
if err != nil { | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package social | ||
|
||
import ( | ||
"github.com/hugobyte/dive-core/cli/common" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
const diveURL = "https://discord.gg/GyRQSBN3Cu" | ||
|
||
var DiscordCmd = common.NewDiveCommandBuilder(). | ||
SetUse("discord"). | ||
SetShort("Opens DIVE discord channel"). | ||
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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package social | ||
|
||
import ( | ||
"github.com/hugobyte/dive-core/cli/common" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
const twitterURL = "https://twitter.com/hugobyte" | ||
|
||
var TwitterCmd = common.NewDiveCommandBuilder(). | ||
SetUse("twitter"). | ||
SetShort("Opens official HugoByte twitter home page"). | ||
SetLong(`The command opens the official HugoByte Twitter homepage. It launches a web browser and directs users to the designated Twitter profile of HugoByte, providing access to the latest updates, announcements, news, and insights | ||
shared by the official HugoByte Twitter account. Users can stay informed about HugoByte's activities, engage with the | ||
community, and follow our social media presence directly from the Twitter homepage.`, | ||
). | ||
SetRun(twitter).Build() | ||
|
||
func twitter(cmd *cobra.Command, args []string) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package utility | ||
|
||
import ( | ||
"github.com/hugobyte/dive-core/cli/common" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var CleanCmd = common.NewDiveCommandBuilder(). | ||
SetUse("clean"). | ||
SetShort("Cleans up Kurtosis leftover artifacts"). | ||
SetLong("Destroys and removes any running encalves. If no enclaves running to remove it will throw an error"). | ||
SetRun(clean).Build() | ||
|
||
func clean(cmd *cobra.Command, args []string) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package utility | ||
|
||
import ( | ||
"github.com/hugobyte/dive-core/cli/common" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
const tutorialURL = "https://www.youtube.com/playlist?list=PL5Xd9z-fRL1vKtRlOzIlkhROspSSDeGyG" | ||
|
||
var TutorialCmd = common.NewDiveCommandBuilder(). | ||
SetUse("tutorial"). | ||
SetShort("Opens DIVE Tutorial Youtube Playlist"). | ||
SetLong( | ||
`The command opens the YouTube playlist containing DIVE tutorials. It launches a web browser or the YouTube application, | ||
directing users to a curated collection of tutorial videos specifically designed to guide and educate users about DIVE. The playlist | ||
offers step-by-step instructions, tips, and demonstrations to help users better understand and utilize the features and functionalities of DIVE.`, | ||
). | ||
SetRun(tutorial). | ||
Build() | ||
|
||
func tutorial(cmd *cobra.Command, args []string) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package utility | ||
|
||
import ( | ||
"github.com/hugobyte/dive-core/cli/common" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var VersionCmd = common.NewDiveCommandBuilder(). | ||
SetUse("version"). | ||
SetShort("Checks The DIVE CLI Version"). | ||
SetLong("Checks the current DIVE CLI version and warns if you are using an old version."). | ||
SetRun(version). | ||
Build() | ||
|
||
func version(cmd *cobra.Command, args []string) {} |