Debian Codegraph @

cmd/soci/commands/internal/index.go

raw symbols SCIP
1 /*
2 Copyright The Soci Snapshotter Authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
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 // SupportedArg checks if a value is present within a given slice
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 }