Skip to content

Commit

Permalink
feat: implement global flag for enclave name
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasbhat0 committed Dec 8, 2023
1 parent 72067d6 commit cb392e2
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions cli/cmd/bridge/ibc/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func ibcRelay(cmd *cobra.Command, args []string) {
if err != nil {
cliContext.Fatalf("Error %s. %s", err, cmd.UsageString())
}
cliContext.Spinner().StartWithMessage("Starting IBC Setup", "green")
cliContext.StartSpinnerIfNotVerbose("Starting IBC Setup", common.DiveLogs)
result, err := RunIbcRelay(cliContext)
if err != nil {
cliContext.Fatal(err)
Expand All @@ -48,5 +48,5 @@ func ibcRelay(cmd *cobra.Command, args []string) {
cliContext.Fatal(err)
}

cliContext.Spinner().StopWithMessage(fmt.Sprintf("IBC Setup Completed between %s and %s. Please find service details in current working directory(dive.json)", chainA, chainB))
cliContext.StopSpinnerIfNotVerbose(fmt.Sprintf("IBC Setup Completed between %s and %s. Please find service details in current working directory(dive.json)", chainA, chainB), common.DiveLogs)
}
2 changes: 1 addition & 1 deletion cli/cmd/bridge/ibc/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func RunIbcRelay(cli *common.Cli) (string, error) {
return "", common.WrapMessageToError(common.ErrInvalidChain, err.Error())
}

enclaveContext, err := cli.Context().GetEnclaveContext(common.DiveEnclave)
enclaveContext, err := cli.Context().GetEnclaveContext(common.EnclaveName)
if err != nil {
return "", common.WrapMessageToError(err, "IBC Setup Failed")
}
Expand Down
5 changes: 2 additions & 3 deletions cli/cmd/chains/archway/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func archway(cmd *cobra.Command, args []string) {
cliContext.Fatalf("Error %s. %s", err, cmd.UsageString())
}

cliContext.Spinner().StartWithMessage("Starting Archway Node", "green")
cliContext.StartSpinnerIfNotVerbose("Starting Archway Node", common.DiveLogs)

response, err := RunArchway(cliContext)

Expand All @@ -45,7 +45,6 @@ func archway(cmd *cobra.Command, args []string) {
cliContext.Fatal(err)

}

cliContext.Spinner().StopWithMessage("Archway Node Started. Please find service details in current working directory(services.json)")
cliContext.StopSpinnerIfNotVerbose("Archway Node Started. Please find service details in current working directory(services.json)", common.DiveLogs)

}
2 changes: 1 addition & 1 deletion cli/cmd/chains/archway/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func RunArchway(cli *common.Cli) (*common.DiveServiceResponse, error) {

enclaveContext, err := cli.Context().GetEnclaveContext(common.DiveEnclave)
enclaveContext, err := cli.Context().GetEnclaveContext(common.EnclaveName)

if err != nil {
return nil, common.WrapMessageToError(err, "Archway Run Failed")
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/chains/eth/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

func RunEth(cli *common.Cli) (*common.DiveServiceResponse, error) {

enclaveContext, err := cli.Context().GetEnclaveContext(common.DiveEnclave)
enclaveContext, err := cli.Context().GetEnclaveContext(common.EnclaveName)
if err != nil {
return nil, common.WrapMessageToError(err, "Eth Run Failed")
}
Expand All @@ -21,7 +21,7 @@ func RunEth(cli *common.Cli) (*common.DiveServiceResponse, error) {
responseData, services, skippedInstructions, err := common.GetSerializedData(cli, response)

if err != nil {
errRemove := cli.Context().RemoveServicesByServiceNames(services, common.DiveEnclave)
errRemove := cli.Context().RemoveServicesByServiceNames(services, common.EnclaveName)
if err != nil {
return nil, common.WrapMessageToError(errRemove, "Eth Run Failed ")
}
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/chains/hardhat/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "github.com/hugobyte/dive-core/cli/common"

func RunHardhat(cli *common.Cli) (*common.DiveServiceResponse, error) {

enclaveContext, err := cli.Context().GetEnclaveContext(common.DiveEnclave)
enclaveContext, err := cli.Context().GetEnclaveContext(common.EnclaveName)

if err != nil {
return nil, common.WrapMessageToError(err, "Hardhat Run Failed")
Expand All @@ -20,7 +20,7 @@ func RunHardhat(cli *common.Cli) (*common.DiveServiceResponse, error) {

responseData, services, skippedInstructions, err := common.GetSerializedData(cli, response)
if err != nil {
errRemove := cli.Context().RemoveServicesByServiceNames(services, common.DiveEnclave)
errRemove := cli.Context().RemoveServicesByServiceNames(services, common.EnclaveName)
if errRemove != nil {
return nil, common.WrapMessageToError(errRemove, "Hardhat Run Failed ")
}
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/chains/icon/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func RunIconNode(cli *common.Cli) (*common.DiveServiceResponse, error) {

enclaveContext, err := cli.Context().GetEnclaveContext(common.DiveEnclave)
enclaveContext, err := cli.Context().GetEnclaveContext(common.EnclaveName)

if err != nil {
return nil, common.WrapMessageToError(err, "Icon Run Failed")
Expand Down Expand Up @@ -72,7 +72,7 @@ func RunIconNode(cli *common.Cli) (*common.DiveServiceResponse, error) {

func RunDecentralization(cli *common.Cli, params string) error {

kurtosisEnclaveContext, err := cli.Context().GetEnclaveContext(common.DiveEnclave)
kurtosisEnclaveContext, err := cli.Context().GetEnclaveContext(common.EnclaveName)

if err != nil {
return common.WrapMessageToError(err, "Icon Decentralization Failed")
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/chains/neutron/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func RunNeutron(cli *common.Cli) (*common.DiveServiceResponse, error) {

enclaveContext, err := cli.Context().GetEnclaveContext(common.DiveEnclave)
enclaveContext, err := cli.Context().GetEnclaveContext(common.EnclaveName)

if err != nil {
return nil, common.WrapMessageToError(err, "Neutron Run Failed")
Expand Down
1 change: 1 addition & 0 deletions cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var rootCmd = common.NewDiveCommandBuilder().
AddCommand(chains.ChainCmd).
AddCommand(bridge.BridgeCmd).
AddBoolPersistentFlag(&common.DiveLogs, "verbose", false, "Prints out logs to Stdout").
AddStringPersistentFlag(&common.EnclaveName, "enclaveName", common.DiveEnclave, "Provide Enclave Name To Start Service In Enclave Group").
SetRunE(run).
Build()

Expand Down
1 change: 0 additions & 1 deletion cli/cmd/utility/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ var CleanCmd = common.NewDiveCommandBuilder().
SetShort("Cleans up Kurtosis leftover artifacts").
SetLong("Destroys and removes any running encalves. If no enclaves running to remove it will throw an error").
AddBoolFlagP("all", "a", false, "To Clean All the Service in Enclave").
AddStringFlagWithShortHand(&common.EnclaveName, "enclaveName", "e", common.DiveEnclave, "Please Provide enclave name to clean").
SetRun(clean).Build()

func clean(cmd *cobra.Command, args []string) {
Expand Down

0 comments on commit cb392e2

Please sign in to comment.