repos / git-pr

a self-hosted git collaboration server
git clone https://github.com/picosh/git-pr.git

commit
c04dace
parent
58bf51e
author
Eric Bower
date
2024-05-11 22:48:25 -0400 EDT
docs
1 files changed,  +33, -15
M cli.go
M cli.go
+33, -15
  1@@ -24,10 +24,28 @@ func getPrID(str string) (int64, error) {
  2 }
  3 
  4 func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
  5+	desc := `Patch requests (PR) are the simplest way to submit, review, and accept changes to your git repository.
  6+Here's how it works:
  7+	- External contributor clones repo (git-clone)
  8+	- External contributor makes a code change (git-add & git-commit)
  9+	- External contributor generates patches (git-format-patch)
 10+	- External contributor submits a PR to SSH server
 11+	- Owner receives RSS notification that there's a new PR
 12+	- Owner applies patches locally (git-am) from SSH server
 13+	- Owner makes suggestions in code! (git-add & git-commit)
 14+	- Owner submits review by piping patch to SSH server (git-format-patch)
 15+	- External contributor receives RSS notification of the PR review
 16+	- External contributor re-applies patches (git-am)
 17+	- External contributor reviews and removes comments in code!
 18+	- External contributor submits another patch (git-format-patch)
 19+	- Owner applies patches locally (git-am)
 20+	- Owner marks PR as accepted and pushes code to main (git-push)`
 21+
 22 	pubkey := be.Pubkey(sesh.PublicKey())
 23 	app := &cli.App{
 24 		Name:        "ssh",
 25-		Description: "A companion SSH server to allow external collaboration",
 26+		Description: desc,
 27+		Usage:       "Collaborate with external contributors to your project",
 28 		Writer:      sesh,
 29 		ErrWriter:   sesh,
 30 		Commands: []*cli.Command{
 31@@ -51,7 +69,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
 32 			},
 33 			{
 34 				Name:  "ls",
 35-				Usage: "list all git repos",
 36+				Usage: "List all git repos",
 37 				Action: func(cCtx *cli.Context) error {
 38 					repos, err := pr.GetRepos()
 39 					if err != nil {
 40@@ -73,11 +91,11 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
 41 			},
 42 			{
 43 				Name:  "pr",
 44-				Usage: "manage patch requests",
 45+				Usage: "Manage Patch Requests (PR)",
 46 				Subcommands: []*cli.Command{
 47 					{
 48 						Name:  "ls",
 49-						Usage: "list all patch requests",
 50+						Usage: "List all PRs",
 51 						Action: func(cCtx *cli.Context) error {
 52 							prs, err := pr.GetPatchRequests()
 53 							if err != nil {
 54@@ -102,7 +120,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
 55 					},
 56 					{
 57 						Name:  "create",
 58-						Usage: "submit a new patch request",
 59+						Usage: "Submit a new PR",
 60 						Action: func(cCtx *cli.Context) error {
 61 							repoID := cCtx.Args().First()
 62 							request, err := pr.SubmitPatchRequest(pubkey, repoID, sesh)
 63@@ -111,7 +129,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
 64 							}
 65 							wish.Printf(
 66 								sesh,
 67-								"Patch Request submitted! Use the ID for interacting with this Patch Request.\nID\tName\n%d\t%s\n",
 68+								"PR submitted! Use the ID for interacting with this PR.\nID\tName\n%d\t%s\n",
 69 								request.ID,
 70 								request.Name,
 71 							)
 72@@ -120,7 +138,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
 73 					},
 74 					{
 75 						Name:  "print",
 76-						Usage: "print the patches for a patch request",
 77+						Usage: "Print the patches for a PR",
 78 						Action: func(cCtx *cli.Context) error {
 79 							prID, err := getPrID(cCtx.Args().First())
 80 							if err != nil {
 81@@ -146,7 +164,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
 82 					},
 83 					{
 84 						Name:  "stats",
 85-						Usage: "print patch request with patch stats",
 86+						Usage: "Print PR with diff stats",
 87 						Action: func(cCtx *cli.Context) error {
 88 							prID, err := getPrID(cCtx.Args().First())
 89 							if err != nil {
 90@@ -197,7 +215,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
 91 					},
 92 					{
 93 						Name:  "summary",
 94-						Usage: "list patches in patch request",
 95+						Usage: "List patches in PRs",
 96 						Action: func(cCtx *cli.Context) error {
 97 							prID, err := getPrID(cCtx.Args().First())
 98 							if err != nil {
 99@@ -248,7 +266,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
100 					},
101 					{
102 						Name:  "accept",
103-						Usage: "accept a patch request",
104+						Usage: "Accept a PR",
105 						Action: func(cCtx *cli.Context) error {
106 							prID, err := getPrID(cCtx.Args().First())
107 							if err != nil {
108@@ -263,7 +281,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
109 					},
110 					{
111 						Name:  "close",
112-						Usage: "close a patch request",
113+						Usage: "Close a PR",
114 						Action: func(cCtx *cli.Context) error {
115 							prID, err := getPrID(cCtx.Args().First())
116 							if err != nil {
117@@ -278,7 +296,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
118 					},
119 					{
120 						Name:  "reopen",
121-						Usage: "reopen a patch request",
122+						Usage: "Reopen a PR",
123 						Action: func(cCtx *cli.Context) error {
124 							prID, err := getPrID(cCtx.Args().First())
125 							if err != nil {
126@@ -293,7 +311,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
127 					},
128 					{
129 						Name:  "add",
130-						Usage: "append a patch to the patch request",
131+						Usage: "Append a patch to a PR",
132 						Flags: []cli.Flag{
133 							&cli.BoolFlag{
134 								Name:  "review",
135@@ -314,7 +332,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
136 							}
137 							isPrOwner := req.Pubkey == be.Pubkey(sesh.PublicKey())
138 							if !isAdmin && !isPrOwner {
139-								return fmt.Errorf("unauthorized, you are not the owner of this Patch Request")
140+								return fmt.Errorf("unauthorized, you are not the owner of this PR")
141 							}
142 
143 							patch, err := pr.SubmitPatch(pubkey, prID, isReview, sesh)
144@@ -349,7 +367,7 @@ func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
145 					},
146 					{
147 						Name:  "comment",
148-						Usage: "comment on a patch request",
149+						Usage: "Comment on a PR",
150 						Action: func(cCtx *cli.Context) error {
151 							return nil
152 						},