A terminal client for Tangled.
tui go tangled cli
13

Configure Feed

Select the types of activity you want to include in your feed.

cli: add pr view command

Aly Raffauf (Jul 8, 2026, 12:07 PM EDT) df6bc2a2 352b94a6

+64
+63
internal/cli/pr_view.go
··· 1 + package cli 2 + 3 + import ( 4 + "fmt" 5 + 6 + "github.com/alyraffauf/tg/tangled" 7 + "github.com/spf13/cobra" 8 + ) 9 + 10 + var prViewRepo string 11 + 12 + var prViewCmd = &cobra.Command{ 13 + Use: "view <rkey>", 14 + Short: "View a pull request for a Tangled repository", 15 + Long: `View a pull request by its rkey (the last segment of its at:// URI). 16 + 17 + If --repo is not set, the repository is detected from the current 18 + directory's git origin remote.`, 19 + Args: cobra.ExactArgs(1), 20 + RunE: func(cmd *cobra.Command, args []string) error { 21 + ctx := cmd.Context() 22 + rkey := args[0] 23 + 24 + targetArgs := []string{} 25 + if prViewRepo != "" { 26 + targetArgs = []string{prViewRepo} 27 + } 28 + handle, repo, err := resolveTarget(ctx, targetArgs) 29 + if err != nil { 30 + return err 31 + } 32 + 33 + repoDid, err := findRepoDid(ctx, handle, repo) 34 + if err != nil { 35 + return err 36 + } 37 + 38 + pulls, err := client.ListPulls(ctx, repoDid, tangled.PullListOpts{ 39 + Limit: defaultListLimit, 40 + }) 41 + if err != nil { 42 + return fmt.Errorf("list PRs for %s/%s: %w", handle, repo, err) 43 + } 44 + 45 + pr, authorDID, err := findPullByRKey(pulls.Items, rkey) 46 + if err != nil { 47 + return err 48 + } 49 + 50 + fmt.Printf("Title: %s\n", pr.Title) 51 + fmt.Printf("Author: %s\n", resolveAuthor(ctx, authorDID)) 52 + fmt.Printf("Created: %s\n", pr.CreatedAt) 53 + fmt.Printf("Branch: %s → %s\n", pr.Source.Branch, pr.Target.Branch) 54 + if pr.Body != "" { 55 + fmt.Printf("\n%s\n", pr.Body) 56 + } 57 + return nil 58 + }, 59 + } 60 + 61 + func init() { 62 + prViewCmd.Flags().StringVarP(&prViewRepo, "repo", "R", "", "Target repository as handle/repo") 63 + }
+1
internal/cli/root.go
··· 50 50 rootCmd.AddCommand(prCmd) 51 51 prCmd.AddCommand(prListCmd) 52 52 prCmd.AddCommand(prCheckoutCmd) 53 + prCmd.AddCommand(prViewCmd) 53 54 54 55 rootCmd.AddCommand(repoCmd) 55 56 repoCmd.AddCommand(repoCloneCmd)