Fix prompt string when creating remote repository
If you are in git project not pushed to remote yet,
prompt says 'This will create {reponame} in current directory. Continue?',
however, it doesn't create while it only adds remote origin.
I was going to create PR to avoid creating new directory before I knew
this behavior.
This behavior is already ideal, so I changed prompt not to scare users
like I got scared.
This commit is contained in:
parent
4e5aa91fac
commit
e461baa217
1 changed files with 5 additions and 3 deletions
|
|
@ -250,7 +250,7 @@ func createRun(opts *CreateOptions) error {
|
|||
|
||||
createLocalDirectory := opts.ConfirmSubmit
|
||||
if !opts.ConfirmSubmit {
|
||||
opts.ConfirmSubmit, err = confirmSubmission(input.Name, input.OwnerID)
|
||||
opts.ConfirmSubmit, err = confirmSubmission(input.Name, input.OwnerID, projectDirErr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -388,11 +388,13 @@ func interactiveRepoCreate(isDescEmpty bool, isVisibilityPassed bool, repoName s
|
|||
return answers.RepoName, answers.RepoDescription, strings.ToUpper(answers.RepoVisibility), nil
|
||||
}
|
||||
|
||||
func confirmSubmission(repoName string, repoOwner string) (bool, error) {
|
||||
func confirmSubmission(repoName string, repoOwner string, projectDirErr error) (bool, error) {
|
||||
qs := []*survey.Question{}
|
||||
|
||||
promptString := ""
|
||||
if repoOwner != "" {
|
||||
if projectDirErr == nil {
|
||||
promptString = fmt.Sprintf("This will add remote origin to your current directory. Continue? ")
|
||||
} else if repoOwner != "" {
|
||||
promptString = fmt.Sprintf("This will create '%s/%s' in your current directory. Continue? ", repoOwner, repoName)
|
||||
} else {
|
||||
promptString = fmt.Sprintf("This will create '%s' in your current directory. Continue? ", repoName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue