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

File Location Flag #2709

Merged
merged 1 commit into from
Jun 30, 2021

Conversation

jcastrence
Copy link
Contributor

Type of change

  • New feature

Description

  • New flag allows the user to specify the location of the resulting json file.

Related issues

@jcastrence jcastrence requested a review from a team as a code owner June 23, 2021 22:23
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("\nSuccessfully compared snapshots. Result saved to %s. Total differences found: %v\n", resultFilename, count)
fmt.Printf("\nSuccessfully compared snapshots. Result saved to %s. Total differences found: %v", resultFilepath, count)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why you removed \n here. The output won't not look nice with the new line. Also, %d fits better instead of %v for count.

Ideally, we should have a test to verify the output that is shown to the user so, these kind of changes don't go unnoticed. You can do that in a separate PR, either by golang Example framework or via a UT by passing the printer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have missed this when I merged since this branch was written before the corrections you made to the original ledger tool utility PR. Removing the newline was not my intention thanks for catching it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as adding tests for the output, that's something I had in the original iteration but ran into some issues and decided to add that in a future PR, so that's coming up as well.

@@ -24,6 +25,7 @@ var (
compare = app.Command("compare", "Compare two ledgers via their snapshots.")
snapshotPath1 = compare.Arg("snapshotPath1", "File path to first ledger snapshot.").Required().String()
snapshotPath2 = compare.Arg("snapshotPath2", "File path to second ledger snapshot.").Required().String()
destination = compare.Flag("destination", "File path to snapshot comparison json results. Default is the current directory.").Short('d').String()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the File path that you expect here. You use this input as a folder and create a file in that. From that point of view, it would be better to call this flag outputdir

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, for the existing args, instead of File path to first ledger snapshot first ledger snapshot dir makes it clearer.

FAB-18425

Signed-off-by: Julian Castrence <juliancastrence@ibm.com>
@manish-sethi manish-sethi merged commit 4c4e58c into hyperledger:main Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants