Skip to content

Commit

Permalink
Add datadir to Command param (#320)
Browse files Browse the repository at this point in the history
* Bump version

* Add datadir to Command param
  • Loading branch information
irisZhangCB authored May 25, 2022
1 parent 0de1e42 commit d1e4514
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var (
endIndex int64
dataResultFile string
constructionResultFile string
dataDirectory string

// Config is the populated *configuration.Configuration from
// the configurationFile. If none is provided, this is set
Expand Down Expand Up @@ -252,6 +253,12 @@ default values.`,
"Result-file configures the location of validation result. This will override the results_output_file from configuration file",
)

checkDataCmd.Flags().StringVar(
&dataDirectory,
"data-dir",
"",
"Data-dir configures the location of logs and data for validation. This will override the data_directory from configuration file",
)
rootCmd.AddCommand(checkDataCmd)
checkConstructionCmd.Flags().StringVar(
&asserterConfigurationFile,
Expand Down Expand Up @@ -348,6 +355,10 @@ func initConfig() {
if len(constructionResultFile) != 0 {
Config.Construction.ResultsOutputFile = constructionResultFile
}

if len(dataDirectory) != 0 {
Config.DataDirectory = dataDirectory
}
}

func ensureDataDirectoryExists() {
Expand Down

0 comments on commit d1e4514

Please sign in to comment.