Documentation
¶
Overview ¶
Package flags defines shared CLI flags and argument parsers.
Index ¶
- Constants
- func Confirm(in io.Reader, out io.Writer, prompt string, assumeYes bool) (bool, error)
- func DryRun() cli.Flag
- func FilterFlags() []cli.Flag
- func Global() []cli.Flag
- func OpenDownloadDestination(path string, stdout io.Writer) (io.WriteCloser, error)
- func OpenInput(path string, stdin io.Reader) (io.ReadCloser, error)
- func OutputFormat(cmd *cli.Command) (string, error)
- func PaginationFlags() []cli.Flag
- func ValidateOutputFlags(cmd *cli.Command) error
- func WantsJSONOutput(cmd *cli.Command) bool
- type GitRepositoryResolver
- type Pagination
- type RepoRef
- type RepoSelection
- func ResolveExplicitRepo(cmd *cli.Command) (RepoSelection, error)
- func ResolveExplicitRepoWith(cmd *cli.Command, current GitRepositoryResolver) (RepoSelection, error)
- func ResolveRepo(cmd *cli.Command) (RepoSelection, error)
- func ResolveRepoContext(cmd *cli.Command) (RepoSelection, error)
- func ResolveRepoContextWith(cmd *cli.Command, current GitRepositoryResolver) (RepoSelection, error)
- func ResolveRepoWith(cmd *cli.Command, current GitRepositoryResolver) (RepoSelection, error)
Constants ¶
const ( ConfigFlag = "config" LoginFlag = "login" BaseURLFlag = "base-url" OutputFlag = "output" JSONFlag = "json" JSONCompactFlag = "json-compact" JQFlag = "jq" JSONErrorsFlag = "json-errors" QuietFlag = "quiet" DryRunFlag = "dry-run" RepoFlag = "repo" OwnerFlag = "owner" )
const ( OutputTable = "table" OutputJSON = "json" OutputJSONCompact = "json-compact" )
const ( PageFlag = "page" PerPageFlag = "per-page" LimitFlag = "limit" PageInfoFlag = "page-info" StateFlag = "state" QueryFlag = "query" YesFlag = "yes" FileFlag = "file" OutputFile = "output-file" )
Variables ¶
This section is empty.
Functions ¶
func Confirm ¶
Confirm asks the user to confirm unless assumeYes is true.
func DryRun ¶
DryRun returns the command-local dry-run flag for supported mutating commands.
func OpenDownloadDestination ¶
OpenDownloadDestination opens a file for writing. A path of "-" writes to stdout.
func OpenInput ¶
OpenInput opens a file for reading. A path of "-" reads from stdin.
func OutputFormat ¶
OutputFormat resolves the effective machine output format.
func PaginationFlags ¶
PaginationFlags returns common pagination flags.
func ValidateOutputFlags ¶
ValidateOutputFlags returns an error for conflicting global output flags.
Types ¶
type GitRepositoryResolver ¶
GitRepositoryResolver resolves the current Git repository from the local working tree.
type Pagination ¶
Pagination contains shared pagination values.
func PaginationFromCommand ¶
func PaginationFromCommand(cmd *cli.Command) Pagination
PaginationFromCommand reads shared pagination flags.
type RepoRef ¶
RepoRef identifies a GitVerse repository.
func DetectCurrentGitRepository ¶
DetectCurrentGitRepository resolves the repository from git remote origin.
func ParseRepo ¶
ParseRepo parses either owner/repo or separate owner and repository names.
type RepoSelection ¶
RepoSelection is a resolved repository and the number of positional arguments consumed by a legacy repository argument.
func ResolveExplicitRepo ¶
func ResolveExplicitRepo(cmd *cli.Command) (RepoSelection, error)
ResolveExplicitRepo resolves a repository for commands where the first positional argument, when present, is explicitly a repository argument.
func ResolveExplicitRepoWith ¶
func ResolveExplicitRepoWith(cmd *cli.Command, current GitRepositoryResolver) (RepoSelection, error)
ResolveExplicitRepoWith resolves an explicit repository argument using a custom current Git repository resolver.
func ResolveRepo ¶
func ResolveRepo(cmd *cli.Command) (RepoSelection, error)
ResolveRepo resolves GH-style repository selection for repo-scoped commands without consuming positional arguments. Commands that accept owner/repo as a positional argument must use ResolveExplicitRepo.
func ResolveRepoContext ¶
func ResolveRepoContext(cmd *cli.Command) (RepoSelection, error)
ResolveRepoContext resolves repository selection without consuming positional arguments. It is intended for commands whose first argument is not a repository but may still need repo placeholders.
func ResolveRepoContextWith ¶
func ResolveRepoContextWith(cmd *cli.Command, current GitRepositoryResolver) (RepoSelection, error)
ResolveRepoContextWith resolves repository selection without consuming positional arguments using a custom current Git repository resolver.
func ResolveRepoWith ¶
func ResolveRepoWith(cmd *cli.Command, current GitRepositoryResolver) (RepoSelection, error)
ResolveRepoWith resolves repository selection using a custom current Git repository resolver.
Source Files
¶
- confirm.go
- doc.go
- global.go
- io.go
- output.go
- pagination.go
- repo.go