Skip to content

Commit

Permalink
Merge pull request #23983 from nalind/manifest-remove-docs
Browse files Browse the repository at this point in the history
podman-manifest-remove: update docs and help output
  • Loading branch information
openshift-merge-bot[bot] authored Sep 17, 2024
2 parents d0642ca + 00c13af commit f29901e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
39 changes: 38 additions & 1 deletion cmd/podman/common/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/podman/manifest/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
}
)
Expand Down
8 changes: 4 additions & 4 deletions docs/source/markdown/podman-manifest-remove.1.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-manifest.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit f29901e

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.