Everything that has to work before the screen is taken over.
gitpro is an escript, so this module's main/1 is the binary. It does three
things and then gets out of the way: reads the arguments, works out which
board to open, and starts Atui.Runtime on Gitpro.Views.Issues.
Why the board is resolved out here
Because failing in a terminal is nicer than failing in a UI. "Not a git
repository", "gh is not installed", "this repository is not on a project
board" are all things to say on stdout with a non-zero exit status, not things
to draw in a box on an alternate screen the person then has to press a key to
leave. Both calls it takes are quick — one git, one small GraphQL query.
Everything slow is left to the UI: the cards are fetched by the view, after the first frame is on screen.
Usage
gitpro the board of the repository you are standing in
gitpro --project 13 that board, when the repository is on several
gitpro --repo owner/name somewhere other than here
gitpro --list the boards this repository is on, and stop
Summary
Functions
The escript entry point.
Picks the board.
The repository to look at: --repo owner/name, or the working directory.
Functions
The escript entry point.
@spec project(Gitpro.Git.repo(), pos_integer() | nil) :: {:ok, Gitpro.Github.project()} | {:error, String.t()}
Picks the board.
With a number, that board or nothing. Without one, the repository's first open
board — Gitpro.Github.projects/1 sorts open ones first — and a message
listing the candidates when there is more than one, because silently choosing
between two boards is the kind of thing that gets noticed an hour later.
@spec repo(keyword()) :: {:ok, Gitpro.Git.repo()} | {:error, String.t()}
The repository to look at: --repo owner/name, or the working directory.
The working directory is the point of the tool, so the switch exists mostly for looking at a board from somewhere that is not its checkout.