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

Add command flag for result file #317

Merged
merged 1 commit into from
May 20, 2022
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 Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"

WORKDIR /go/src

ARG VERSION=v0.7.7
ARG VERSION=v0.7.9
RUN git clone https://github.com/coinbase/rosetta-cli.git && \
cd rosetta-cli && \
git fetch --all --tags && \
Expand Down
41 changes: 32 additions & 9 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ var (
PersistentPreRunE: rootPreRun,
}

configurationFile string
cpuProfile string
memProfile string
blockProfile string
onlineURL string
offlineURL string
startIndex int64
endIndex int64
configurationFile string
cpuProfile string
memProfile string
blockProfile string
onlineURL string
offlineURL string
startIndex int64
endIndex int64
dataResultFile string
constructionResultFile string

// Config is the populated *configuration.Configuration from
// the configurationFile. If none is provided, this is set
Expand Down Expand Up @@ -243,6 +245,13 @@ default values.`,
`End-block configures the syncer to stop once reaching a particular block height. This will override the index from configuration file`,
)

checkDataCmd.Flags().StringVar(
&dataResultFile,
"result-file",
"",
"Result-file configures the location of validation result. This will override the results_output_file from configuration file",
)

rootCmd.AddCommand(checkDataCmd)
checkConstructionCmd.Flags().StringVar(
&asserterConfigurationFile,
Expand All @@ -265,6 +274,12 @@ default values.`,
"Override offline node url in configuration file",
)

checkConstructionCmd.Flags().StringVar(
&constructionResultFile,
"result-file",
"",
"Result-file configures the location of validation result. This will override the results_output_file from configuration file",
)
rootCmd.AddCommand(checkConstructionCmd)

// View Commands
Expand Down Expand Up @@ -325,6 +340,14 @@ func initConfig() {
if endIndex != -1 {
Config.Data.EndConditions.Index = &endIndex
}

if len(dataResultFile) != 0 {
Config.Data.ResultsOutputFile = dataResultFile
}

if len(constructionResultFile) != 0 {
Config.Construction.ResultsOutputFile = constructionResultFile
}
}

func ensureDataDirectoryExists() {
Expand Down Expand Up @@ -360,6 +383,6 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print rosetta-cli version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("v0.7.7")
fmt.Println("v0.7.9")
},
}