MCPcopy
hub / github.com/cli/cli / checkArchiveTypeOption

Function checkArchiveTypeOption

pkg/cmd/release/download/download.go:117–134  ·  view source on GitHub ↗
(opts *DownloadOptions)

Source from the content-addressed store, hash-verified

115}
116
117func checkArchiveTypeOption(opts *DownloadOptions) error {
118 if len(opts.ArchiveType) == 0 {
119 return nil
120 }
121
122 if err := cmdutil.MutuallyExclusive(
123 "specify only one of '--pattern' or '--archive'",
124 true, // ArchiveType len > 0
125 len(opts.FilePatterns) > 0,
126 ); err != nil {
127 return err
128 }
129
130 if opts.ArchiveType != "zip" && opts.ArchiveType != "tar.gz" {
131 return cmdutil.FlagErrorf("the value for `--archive` must be one of \"zip\" or \"tar.gz\"")
132 }
133 return nil
134}
135
136func downloadRun(opts *DownloadOptions) error {
137 httpClient, err := opts.HttpClient()

Callers 1

NewCmdDownloadFunction · 0.85

Calls 2

MutuallyExclusiveFunction · 0.92
FlagErrorfFunction · 0.92

Tested by

no test coverage detected