Merge pull request #23983 from nalind/manifest-remove-docs

podman-manifest-remove: update docs and help output
This commit is contained in:
openshift-merge-bot[bot] 2024-09-17 18:52:30 +00:00 committed by GitHub
commit f29901ef1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 47 additions and 10 deletions

View File

@ -224,6 +224,29 @@ func getImages(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellComp
return suggestions, cobra.ShellCompDirectiveNoFileComp
}
func getManifestListMembers(cmd *cobra.Command, list, toComplete string) ([]string, cobra.ShellCompDirective) {
suggestions := []string{}
inspectOptions := entities.ManifestInspectOptions{}
engine, err := setupImageEngine(cmd)
if err != nil {
cobra.CompErrorln(err.Error())
return nil, cobra.ShellCompDirectiveNoFileComp
}
listData, err := engine.ManifestInspect(registry.GetContext(), list, inspectOptions)
if err != nil {
cobra.CompErrorln(err.Error())
return nil, cobra.ShellCompDirectiveNoFileComp
}
for _, item := range listData.Manifests {
if strings.HasPrefix(item.Digest.String(), toComplete) {
suggestions = append(suggestions, item.Digest.String())
}
}
return suggestions, cobra.ShellCompDirectiveNoFileComp
}
func getSecrets(cmd *cobra.Command, toComplete string, cType completeType) ([]string, cobra.ShellCompDirective) {
suggestions := []string{}
@ -611,7 +634,21 @@ func AutocompleteImages(cmd *cobra.Command, args []string, toComplete string) ([
return getImages(cmd, toComplete)
}
// AutocompleteImageSearchFilters - Autocomplate `search --filter`.
// AutocompleteManifestListAndMember - Autocomplete names of manifest lists and digests of items in them.
func AutocompleteManifestListAndMember(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if !validCurrentCmdLine(cmd, args, toComplete) {
return nil, cobra.ShellCompDirectiveNoFileComp
}
if len(args) == 0 {
return getImages(cmd, toComplete)
}
if len(args) == 1 {
return getManifestListMembers(cmd, args[0], toComplete)
}
return nil, cobra.ShellCompDirectiveNoFileComp
}
// AutocompleteImageSearchFilters - Autocomplete `search --filter`.
func AutocompleteImageSearchFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return libimageDefine.SearchFilters, cobra.ShellCompDirectiveNoFileComp
}

View File

@ -10,12 +10,12 @@ import (
var (
removeCmd = &cobra.Command{
Use: "remove LIST IMAGE",
Short: "Remove an entry from a manifest list or image index",
Long: "Removes an image from a manifest list or image index.",
Use: "remove LIST DIGEST",
Short: "Remove an item from a manifest list or image index",
Long: "Removes an item from a manifest list or image index.",
RunE: remove,
Args: cobra.ExactArgs(2),
ValidArgsFunction: common.AutocompleteImages,
ValidArgsFunction: common.AutocompleteManifestListAndMember,
Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
}
)

View File

@ -1,13 +1,13 @@
% podman-manifest-remove 1
## NAME
podman\-manifest\-remove - Remove an image from a manifest list or image index
podman\-manifest\-remove - Remove an item from a manifest list or image index
## SYNOPSIS
**podman manifest remove** *listnameorindexname* *transport:details*
**podman manifest remove** *listnameorindexname* *digest*
## DESCRIPTION
Removes the image with the specified digest from the specified manifest list or image index.
Removes the item with the specified digest from the specified manifest list or image index.
## RETURN VALUE
The list image's ID and the digest of the removed image's manifest.
@ -17,7 +17,7 @@ The list image's ID and the digest of the removed image's manifest.
Remove specified digest from the manifest list:
```
podman manifest remove mylist:v1.11 sha256:cb8a924afdf0229ef7515d9e5b3024e23b3eb03ddbba287f4a19c6ac90b8d221
e604eabaaee4858232761b4fef84e2316ed8f93e15eceafce845966ee3400036 :sha256:cb8a924afdf0229ef7515d9e5b3024e23b3eb03ddbba287f4a19c6ac90b8d221
podman manifest remove e604eabaaee4858232761b4fef84e2316ed8f93e15eceafce845966ee3400036 sha256:cb8a924afdf0229ef7515d9e5b3024e23b3eb03ddbba287f4a19c6ac90b8d221
```
## SEE ALSO

View File

@ -21,7 +21,7 @@ The `podman manifest` command provides subcommands which can be used to:
| exists | [podman-manifest-exists(1)](podman-manifest-exists.1.md) | Check if the given manifest list exists in local storage |
| inspect | [podman-manifest-inspect(1)](podman-manifest-inspect.1.md) | Display a manifest list or image index. |
| push | [podman-manifest-push(1)](podman-manifest-push.1.md) | Push a manifest list or image index to a registry. |
| remove | [podman-manifest-remove(1)](podman-manifest-remove.1.md) | Remove an image from a manifest list or image index. |
| remove | [podman-manifest-remove(1)](podman-manifest-remove.1.md) | Remove an item from a manifest list or image index. |
| rm | [podman-manifest-rm(1)](podman-manifest-rm.1.md) | Remove manifest list or image index from local storage. |
## EXAMPLES