Documentation
¶
Overview ¶
cmd/factory/finish/finish.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FinishCmd = &cobra.Command{ Use: "finish", RunE: func(cmd *cobra.Command, _ []string) error { presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr()) ctx := cmd.Context() presenter.Summary("Finishing work on the current branch.") gitClient, err := git.NewClient( ctx, ".", git.GitClientConfig{ Logger: globals.AppLogger, Executor: globals.ExecClient.UnderlyingExecutor(), }, ) if err != nil { return err } currentBranch, err := gitClient.GetCurrentBranchName(ctx) if err != nil { return err } if currentBranch == gitClient.MainBranchName() { return errors.New("cannot create a pull request from the main branch") } if err := gitClient.Push(ctx, currentBranch); err != nil { return err } if !globals.ExecClient.CommandExists("gh") { presenter.Warning("GitHub CLI ('gh') not found. Cannot create PR automatically.") return nil } confirmed, err := presenter.PromptForConfirmation("Create a GitHub Pull Request now?") if err != nil { return err } if !confirmed { presenter.Info("Aborted. You can create the PR later by running 'gh pr create'.") return nil } presenter.Step("Running 'gh pr create'...") if err := globals.ExecClient.Execute(ctx, ".", "gh", "pr", "create", "--fill", "--web"); err != nil { return err } presenter.Success("Pull Request created.") return nil }, }
FinishCmd represents the finish command.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.