Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: file writes #49

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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