Skip to content

Commit

Permalink
Update input prompts with colored text, modify force flag description
Browse files Browse the repository at this point in the history
  • Loading branch information
chand1012 committed May 3, 2023
1 parent d5489b8 commit 8b6d664
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions cmd/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Requires Git to be installed on the system. If a title is not provided, one will

log.Debugf("Got %d logs", len(strings.Split(logs, "\n")))

fmt.Print("Title: ")
utils.PrintColoredText("Title: ", c.OttoColor)
if title == "" {
// generate the title
log.Debug("Generating title...")
Expand All @@ -78,6 +78,8 @@ Requires Git to be installed on the system. If a title is not provided, one will
log.Errorf("Error printing chat completion stream: %s", err)
os.Exit(1)
}
} else {
fmt.Println(title)
}

log.Debugf("Title: %s", title)
Expand Down Expand Up @@ -149,7 +151,7 @@ Requires Git to be installed on the system. If a title is not provided, one will
prompt = "Title: " + title + "\n\nGit logs: " + logs + "\n\nGit diff: " + diff
}

fmt.Print("Body: ")
utils.PrintColoredText("Body: ", c.OttoColor)
stream, err := ai.PRBody(prompt, c)
if err != nil {
log.Errorf("Error generating PR body: %s", err)
Expand All @@ -162,7 +164,8 @@ Requires Git to be installed on the system. If a title is not provided, one will
os.Exit(1)
}

fmt.Println("Branch: ", base)
utils.PrintColoredText("Branch: ", c.OttoColor)
fmt.Println(base)

if !push {
os.Exit(0)
Expand Down
8 changes: 4 additions & 4 deletions cmd/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ It will create a new release given a tag and post it to GitHub as a draft.`,
}

if previousTag == "" {
previousTag, err = utils.Input("Previous tag: ")
previousTag, err = utils.InputWithColor("Previous tag: ", c.UserColor)
if err != nil {
log.Errorf("Error getting previous tag: %s", err)
os.Exit(1)
}
}

if currentTag == "" {
currentTag, err = utils.Input("Current tag: ")
currentTag, err = utils.InputWithColor("Current tag: ", c.UserColor)
if err != nil {
log.Errorf("Error getting current tag: %s", err)
os.Exit(1)
}
}

fmt.Print("Release notes: ")
utils.PrintColoredText("Release notes: ", c.OttoColor)

// get the log between the tags
gitLog, err := git.LogBetween(previousTag, currentTag)
Expand Down Expand Up @@ -114,7 +114,7 @@ func init() {
RootCmd.AddCommand(releaseCmd)

releaseCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
releaseCmd.Flags().BoolVarP(&force, "force", "f", false, "Force overwrite of existing file")
releaseCmd.Flags().BoolVarP(&force, "force", "f", false, "Do not prompt for confirmation")
releaseCmd.Flags().StringVarP(&previousTag, "prev-tag", "p", "", "Previous tag")
releaseCmd.Flags().StringVarP(&currentTag, "tag", "t", "", "Current tag")
}

0 comments on commit 8b6d664

Please sign in to comment.