aboutsummaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-10-02 08:59:07 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-10-02 08:59:07 -0400
commitf9140f7efcb56b0e7e5967e7dc17a48150345298 (patch)
tree08e0f9f48f77370cf3bf0fa009a6efad008d1b19 /vendor
parent14fd7b4d6ac18aaa5705990f3dd0ed13477258ad (diff)
downloadpodman-f9140f7efcb56b0e7e5967e7dc17a48150345298.tar.gz
podman-f9140f7efcb56b0e7e5967e7dc17a48150345298.tar.bz2
podman-f9140f7efcb56b0e7e5967e7dc17a48150345298.zip
Bump github.com/containers/common from 0.23.0 to 0.24.0
Bumps [github.com/containers/common](https://github.com/containers/common) from 0.23.0 to 0.24.0. - [Release notes](https://github.com/containers/common/releases) - [Commits](https://github.com/containers/common/compare/v0.23.0...v0.24.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/containers/common/pkg/completion/completion.go69
-rw-r--r--vendor/github.com/containers/common/version/version.go2
-rw-r--r--vendor/modules.txt2
3 files changed, 70 insertions, 3 deletions
diff --git a/vendor/github.com/containers/common/pkg/completion/completion.go b/vendor/github.com/containers/common/pkg/completion/completion.go
index 6e7ddff30..07451e992 100644
--- a/vendor/github.com/containers/common/pkg/completion/completion.go
+++ b/vendor/github.com/containers/common/pkg/completion/completion.go
@@ -1,6 +1,14 @@
package completion
-import "github.com/spf13/cobra"
+import (
+ "bufio"
+ "os"
+ "strings"
+ "unicode"
+
+ "github.com/containers/common/pkg/capabilities"
+ "github.com/spf13/cobra"
+)
// FlagCompletions - hold flag completion functions to be applied later with CompleteCommandFlags()
type FlagCompletions map[string]func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
@@ -24,3 +32,62 @@ func AutocompleteNone(cmd *cobra.Command, args []string, toComplete string) ([]s
func AutocompleteDefault(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveDefault
}
+
+// AutocompleteCapabilities - Autocomplete linux capabilities options.
+// Used by --cap-add and --cap-drop.
+func AutocompleteCapabilities(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ caps := capabilities.AllCapabilities()
+
+ // convertCase will convert a string to lowercase only if the user input is lowercase
+ convertCase := func(s string) string { return s }
+ if len(toComplete) > 0 && unicode.IsLower(rune(toComplete[0])) {
+ convertCase = strings.ToLower
+ }
+
+ // offset is used to trim "CAP_" if the user doesn't type CA... or ca...
+ offset := 0
+ if !strings.HasPrefix(toComplete, convertCase("CA")) {
+ // setting the offset to 4 is safe since each cap starts with CAP_
+ offset = 4
+ }
+
+ var completions []string
+ for _, cap := range caps {
+ completions = append(completions, convertCase(cap)[offset:])
+ }
+
+ // add ALL here which is also a valid argument
+ completions = append(completions, convertCase(capabilities.All))
+ return completions, cobra.ShellCompDirectiveNoFileComp
+}
+
+// autocompleteSubIDName - autocomplete the names in /etc/subuid or /etc/subgid
+func autocompleteSubIDName(filename string) ([]string, cobra.ShellCompDirective) {
+ file, err := os.Open(filename)
+ if err != nil {
+ return nil, cobra.ShellCompDirectiveError
+ }
+ defer file.Close()
+
+ var names []string
+ scanner := bufio.NewScanner(file)
+ for scanner.Scan() {
+ name := strings.SplitN(scanner.Text(), ":", 2)[0]
+ names = append(names, name)
+ }
+ if err = scanner.Err(); err != nil {
+ return nil, cobra.ShellCompDirectiveError
+ }
+
+ return names, cobra.ShellCompDirectiveNoFileComp
+}
+
+// AutocompleteSubgidName - Autocomplete subgidname based on the names in the /etc/subgid file.
+func AutocompleteSubgidName(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ return autocompleteSubIDName("/etc/subgid")
+}
+
+// AutocompleteSubuidName - Autocomplete subuidname based on the names in the /etc/subuid file.
+func AutocompleteSubuidName(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ return autocompleteSubIDName("/etc/subuid")
+}
diff --git a/vendor/github.com/containers/common/version/version.go b/vendor/github.com/containers/common/version/version.go
index eaa728791..8e69c7daf 100644
--- a/vendor/github.com/containers/common/version/version.go
+++ b/vendor/github.com/containers/common/version/version.go
@@ -1,4 +1,4 @@
package version
// Version is the version of the build.
-const Version = "0.23.0"
+const Version = "0.24.0"
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 0a7e6ad44..e1c2b6300 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -87,7 +87,7 @@ github.com/containers/buildah/pkg/secrets
github.com/containers/buildah/pkg/supplemented
github.com/containers/buildah/pkg/umask
github.com/containers/buildah/util
-# github.com/containers/common v0.23.0
+# github.com/containers/common v0.24.0
github.com/containers/common/pkg/apparmor
github.com/containers/common/pkg/apparmor/internal/supported
github.com/containers/common/pkg/auth