@@ -8,6 +8,7 @@ const untag = new Command({
8
8
command : 'untag <id> [tags..]' ,
9
9
category : 'Images' ,
10
10
description : 'Untag an image' ,
11
+ usage : 'Untagging an image will result in the removal of tag. If registry not specified - default is used' ,
11
12
webDocs : {
12
13
category : 'Images' ,
13
14
title : 'Untag Image' ,
@@ -21,23 +22,24 @@ const untag = new Command({
21
22
. positional ( 'names' , {
22
23
description : 'Tag names' ,
23
24
} )
24
- . example ( 'codefresh untag 2dfacdaad466 1.0.0' , "Remove tag '1.0.0' from image '2dfacdaad466'" )
25
+ . option ( 'registry' , {
26
+ alias : 'r' ,
27
+ description : 'Registry integration name' ,
28
+ } )
29
+ . example ( 'codefresh untag 2dfacdaad466 1.0.0' , "Remove tag '1.0.0' from image '2dfacdaad466' on default registry" )
30
+ . example ( 'codefresh untag 2dfacdaad466 1.0.0 --registry dockerhub' , "Remove tag '2dfacdaad466' with a new tag: '1.0.0' on dockerhub" )
25
31
. example ( 'codefresh untag 2dfacdaad466 1.0.0 my-tag' , "Remove tags '1.0.0' and 'my-tag' from image'2dfacdaad466'" ) ;
26
32
27
33
return yargs ;
28
34
} ,
29
35
handler : async ( argv ) => {
30
- let id = argv . id ;
36
+ const id = argv . id ;
31
37
const tags = argv . tags ;
32
-
33
- const result = await sdk . images . get ( { id } ) ;
34
- id = result . _id ;
38
+ const registry = argv . registry ;
35
39
36
40
await Promise . each ( tags , async ( tag ) => {
37
- const foundTag = _ . find ( result . tags , info => info . tag == tag ) ; // eslint-disable-line
38
- tag = foundTag && foundTag . _id ;
39
- await sdk . images . untag ( { id, tag } ) ;
40
- console . log ( `Tag: ${ tag } was successfully removed from image: ${ id } ` ) ;
41
+ await sdk . images . untag ( { id, tag, registry } ) ;
42
+ console . log ( `Tag "${ tag } " was successfully removed from image "${ id } " on "${ registry || 'default' } " registry'` ) ;
41
43
} ) ;
42
44
} ,
43
45
} ) ;
0 commit comments