| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package internal |
| 18 |
|
| 19 |
import "github.com/urfave/cli" |
| 20 |
|
| 21 |
const ( |
| 22 |
ExistingIndexFlagName = "existing-index" |
| 23 |
Warn = "warn" |
| 24 |
Skip = "skip" |
| 25 |
Allow = "allow" |
| 26 |
) |
| 27 |
|
| 28 |
var SupportedExistingIndexOptions = []string{Warn, Skip, Allow} |
| 29 |
|
| 30 |
var ExistingIndexFlag = cli.StringFlag{ |
| 31 |
Name: ExistingIndexFlagName, |
| 32 |
Value: Warn, |
| 33 |
Usage: `Configure how to handle existing SOCI artifacts in remote when pushing indices |
| 34 |
warn - print warning message to stdout but push index anyway |
| 35 |
skip - skip pushing the index |
| 36 |
allow - push the index regardless |
| 37 |
`, |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
func SupportedArg[K comparable](v K, list []K) bool { |
| 42 |
for _, o := range list { |
| 43 |
if v == o { |
| 44 |
return true |
| 45 |
} |
| 46 |
} |
| 47 |
return false |
| 48 |
} |