Skip to content

Commit

Permalink
fix(cmd/add): title and message flags work and override the dataset.C…
Browse files Browse the repository at this point in the history
…ommit fields
  • Loading branch information
ramfox committed Jun 1, 2018
1 parent cf36e59 commit 0ef9b80
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ func initDataset(name repo.DatasetRef, cmd *cobra.Command) {
ExitIfErr(err)
}

if dsp.Commit == nil && (addDsTitle != "" || addDsMessage != "") {
dsp.Commit = &dataset.CommitPod{}
}

if addDsTitle != "" {
dsp.Commit.Title = addDsTitle
}

if addDsMessage != "" {
dsp.Commit.Message = addDsMessage
}

p := &core.SaveParams{
Dataset: dsp,
Private: addDsPrivate,
Expand Down Expand Up @@ -157,7 +169,7 @@ func init() {
datasetAddCmd.Flags().StringVarP(&addDsFile, "file", "f", "", "dataset data file in either yaml or json format")
datasetAddCmd.Flags().StringVarP(&addDsDataPath, "data", "d", "", "path to file or url to initialize from")
datasetAddCmd.Flags().StringVarP(&addDsTitle, "title", "t", "", "commit title")
datasetAddCmd.Flags().StringVarP(&addDsMessage, "messsage", "m", "", "commit message")
datasetAddCmd.Flags().StringVarP(&addDsMessage, "message", "m", "", "commit message")
datasetAddCmd.Flags().BoolVarP(&addDsPrivate, "private", "", false, "make dataset private. WARNING: not yet implimented. Please refer to https://github.com/qri-io/qri/issues/291 for updates")
// datasetAddCmd.Flags().BoolVarP(&addDsShowValidation, "show-validation", "s", false, "display a list of validation errors upon adding")
RootCmd.AddCommand(datasetAddCmd)
Expand Down

0 comments on commit 0ef9b80

Please sign in to comment.