mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-19 11:31:03 +00:00
* fix: make patch list registry-only * feat: add patch command progress logs * fix: address review feedback for PR #921
47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/browseros-ai/BrowserOS/packages/browseros/tools/patch/internal/engine"
|
|
"github.com/browseros-ai/BrowserOS/packages/browseros/tools/patch/internal/ui"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
var message string
|
|
command := &cobra.Command{
|
|
Use: "publish [remote]",
|
|
Annotations: map[string]string{"group": "Remote:"},
|
|
Short: "Commit and push chromium_patches to a remote",
|
|
Args: cobra.MaximumNArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
info, err := repoInfo()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
remote := "origin"
|
|
if len(args) == 1 {
|
|
remote = args[0]
|
|
}
|
|
result, err := engine.Publish(cmd.Context(), engine.PublishOptions{
|
|
Repo: info,
|
|
Remote: remote,
|
|
Message: message,
|
|
Progress: commandProgress(cmd),
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return renderResult(result, func() {
|
|
fmt.Println(ui.Success("Published chromium_patches"))
|
|
fmt.Printf("%s %s\n", ui.Muted("remote:"), result.Remote)
|
|
fmt.Printf("%s %s\n", ui.Muted("branch:"), result.Branch)
|
|
fmt.Printf("%s %s\n", ui.Muted("message:"), result.Message)
|
|
})
|
|
},
|
|
}
|
|
command.Flags().StringVarP(&message, "message", "m", "", "Commit message for the patch publish commit")
|
|
rootCmd.AddCommand(command)
|
|
}
|