package main import ( "context" "fmt" "os" ) const usage = `br br auth [server] sign in, prints a link to open br propose [remote] push HEAD to refs/proposals/new br fetch fetch proposal n to the branch prop-n br notes fetch every note ref br threads list the threads you have fetched br thread print thread n br reply -m append a comment and push the note Every command prints the git it runs before it runs it. Nothing here is required: each one is a shortcut for a command you can type yourself. ` func main() { if err := run(os.Args[1:]); err != nil { fmt.Fprintln(os.Stderr, "br: "+err.Error()) os.Exit(1) } } func run(args []string) error { if len(args) == 0 { fmt.Print(usage) return nil } ctx := context.Background() switch args[0] { case "auth": return cmdAuth(ctx, args[1:]) case "propose": return cmdPropose(ctx, args[1:]) case "fetch": return cmdFetchProposal(ctx, args[1:]) case "notes": return cmdNotes(ctx, args[1:]) case "threads": return cmdThreads(ctx, args[1:]) case "thread": return cmdThread(ctx, args[1:]) case "reply": return cmdReply(ctx, args[1:]) case "help", "-h", "--help": fmt.Print(usage) return nil default: return fmt.Errorf("%q is not a br command. run br with no arguments to see them", args[0]) } }