From 42923d15c1d35dbbc0e63b1520966bc9d15cb4af Mon Sep 17 00:00:00 2001 From: Abdul Rabbani Date: Wed, 20 Apr 2022 09:25:47 -0400 Subject: [PATCH] Update cobra to require `head` or `historic` when using `capture`. --- README.md | 14 ++++++++++++++ cmd/capture.go | 17 +++++------------ cmd/head.go | 9 ++------- cmd/historic.go | 9 ++------- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 77b377e..88998e9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,19 @@ This application will capture all the `BeaconState`'s and `SignedBeaconBlock`'s from the consensus chain on Ethereum. +# Running the Application + +To run the application, utilize the following command, and update the values as needed. + +``` +go run main.go capture head --db.address localhost \ + --db.password password \ + --db.port 8077 \ + --db.username username \ + --lh.address localhost \ + --lh.port 5052 +``` + # Contribution If you want to contribute please make sure you do the following: @@ -9,6 +22,7 @@ If you want to contribute please make sure you do the following: - Create a Github issue before starting your work. - Follow the branching structure. - Delete your branch once it has been merged. + - Do not delete the `develop` branch. We can add branch protection once we make the branch public. ## Branching Structure diff --git a/cmd/capture.go b/cmd/capture.go index b0e35c9..52b5315 100644 --- a/cmd/capture.go +++ b/cmd/capture.go @@ -5,24 +5,17 @@ Copyright © 2022 NAME HERE package cmd import ( - "fmt" - "github.com/spf13/cobra" ) // captureCmd represents the capture command var captureCmd = &cobra.Command{ Use: "capture", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("capture called") - }, + Short: "Capture the SignedBeaconBlocks and BeaconStates from the Beacon Chain", + Long: `Capture SignedBeaconBlocks and BeaconStates from the Beacon Chain. + These blocks and states will be captured in + Postgres. They require a lighthouse client to be connected. You can run this to + capture blocks and states at head or historic blocks.`, } func init() { diff --git a/cmd/head.go b/cmd/head.go index d5b7e2f..f0e4675 100644 --- a/cmd/head.go +++ b/cmd/head.go @@ -13,13 +13,8 @@ import ( // headCmd represents the head command var headCmd = &cobra.Command{ Use: "head", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, + Short: "Capture only the blocks and state at head.", + Long: `Capture only the blocks and state at head.`, Run: func(cmd *cobra.Command, args []string) { fmt.Println("head called") }, diff --git a/cmd/historic.go b/cmd/historic.go index e29f167..7b6feeb 100644 --- a/cmd/historic.go +++ b/cmd/historic.go @@ -13,13 +13,8 @@ import ( // historicCmd represents the historic command var historicCmd = &cobra.Command{ Use: "historic", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, + Short: "Capture the historic blocks and states.", + Long: `Capture the historic blocks and states.`, Run: func(cmd *cobra.Command, args []string) { fmt.Println("historic called") },