refactor(cache delete): simplify condition

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2025-08-28 10:02:03 +01:00
parent 926327ce6d
commit 842d3449b4
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E

View file

@ -95,9 +95,8 @@ func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Co
return cmdutil.FlagErrorf("must provide either cache id, cache key, or use --all")
}
if len(args) > 0 {
_, isID := parseCacheID(args[0])
if opts.Ref != "" && isID {
if len(args) > 0 && opts.Ref != "" {
if _, ok := parseCacheID(args[0]); ok {
return cmdutil.FlagErrorf("--ref cannot be used with cache ID")
}
}