Skip to content

Commit

Permalink
fix: file writes (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasbhat0 authored Jul 19, 2023
1 parent 3e88ab7 commit 8f682aa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cli/commands/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func btpBridgeCmd(diveContext *common.DiveContext) *cobra.Command {
diveContext.FatalError("Chains Not Supported", "Supported Chains [icon,eth,hardhat]")
}

diveContext.StopSpinner(fmt.Sprintf("BTP Bridge Setup Completed between %s and %s", chainA, chainB))
diveContext.StopSpinner(fmt.Sprintf("BTP Bridge Setup Completed between %s and %s. Please find service details in current working directory(dive.json)", chainA, chainB))
},
}

Expand Down
2 changes: 1 addition & 1 deletion cli/commands/chain/types/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ It establishes a connection to the Ethereum network and allows the node in execu
if err != nil {
diveContext.FatalError("Failed To Write To File", err.Error())
}
diveContext.StopSpinner("ETH Node Started")
diveContext.StopSpinner("ETH Node Started. Please find service details in current working directory(dive.json)")
},
}

Expand Down
2 changes: 1 addition & 1 deletion cli/commands/chain/types/hardhat.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ It establishes a connection to the hardhat network and allows the node in execut
if err != nil {
diveContext.FatalError("Failed To Write To File", err.Error())
}
diveContext.StopSpinner("Hardhat Node Started")
diveContext.StopSpinner("Hardhat Node Started. Please find service details in current working directory(dive.json)")
},
}

Expand Down
6 changes: 3 additions & 3 deletions cli/commands/chain/types/icon.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ It establishes a connection to the Icon network and allows the node in executing
diveContext.FatalError("Failed To Write To File", err.Error())
}

diveContext.StopSpinner("Icon Node Started")
diveContext.StopSpinner("Icon Node Started. Please find service details in current working directory(dive.json) in current working directory")

} else {

Expand All @@ -134,7 +134,7 @@ It establishes a connection to the Icon network and allows the node in executing
diveContext.FatalError("Failed To Write To File", err.Error())
}

diveContext.StopSpinner("Icon Node Started")
diveContext.StopSpinner("Icon Node Started. Please find service details in current working directory(dive.json)")
}

},
Expand Down Expand Up @@ -168,7 +168,7 @@ func IconDecentralisationCmd(diveContext *common.DiveContext) *cobra.Command {
diveContext.FatalError("Icon Node Decentralisation Failed", err.Error())
}

diveContext.StopSpinner(fmt.Sprintln("Decentralisation Completed ", response))
diveContext.StopSpinner(fmt.Sprintln("Decentralisation Completed.Please find service details in dive.json", response))
},
}
decentralisationCmd.Flags().StringVarP(&serviceName, "serviceName", "s", "", "service name")
Expand Down
13 changes: 12 additions & 1 deletion cli/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,18 @@ func ReadConfigFile(filePath string) ([]byte, error) {
return file, nil
}
func WriteToFile(data string) error {
file, err := os.Create("dive.json")

pwd, err := os.Getwd()

if err != nil {
return err
}

file, err := os.OpenFile(pwd+"/dive.json", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return err
}

if err != nil {
return err
}
Expand Down

0 comments on commit 8f682aa

Please sign in to comment.