From c725feabfc2a05d854682f8b92171aec054fd72a Mon Sep 17 00:00:00 2001 From: iris-zhang Date: Fri, 20 May 2022 12:23:13 -0700 Subject: [PATCH] Add command flag for result file --- Dockerfile | 2 +- cmd/root.go | 41 ++++++++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 396713c6..4840968b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 && \ diff --git a/cmd/root.go b/cmd/root.go index 9c82db8a..0291ee33 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -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 @@ -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, @@ -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 @@ -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() { @@ -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") }, }