@@ -8,6 +8,7 @@ const untag = new Command({
88 command : 'untag <id> [tags..]' ,
99 category : 'Images' ,
1010 description : 'Untag an image' ,
11+ usage : 'Untagging an image will result in the removal of tag. If registry not specified - default is used' ,
1112 webDocs : {
1213 category : 'Images' ,
1314 title : 'Untag Image' ,
@@ -21,23 +22,24 @@ const untag = new Command({
2122 . positional ( 'names' , {
2223 description : 'Tag names' ,
2324 } )
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" )
2531 . example ( 'codefresh untag 2dfacdaad466 1.0.0 my-tag' , "Remove tags '1.0.0' and 'my-tag' from image'2dfacdaad466'" ) ;
2632
2733 return yargs ;
2834 } ,
2935 handler : async ( argv ) => {
30- let id = argv . id ;
36+ const id = argv . id ;
3137 const tags = argv . tags ;
32-
33- const result = await sdk . images . get ( { id } ) ;
34- id = result . _id ;
38+ const registry = argv . registry ;
3539
3640 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'` ) ;
4143 } ) ;
4244 } ,
4345} ) ;
0 commit comments