File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
interface/cli/commands/image Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -7,28 +7,29 @@ const { image } = require('../../../../logic').api;
7
7
8
8
const tag = new Command ( {
9
9
root : true ,
10
- command : 'tag <id>' ,
10
+ command : 'tag <id> [tags..] ' ,
11
11
description : 'Add an image tag' ,
12
12
builder : ( yargs ) => {
13
13
yargs
14
- . option ( 'tag' , {
15
- describe : 'image tags' ,
16
- type : 'array' ,
17
- require : true ,
14
+ . positional ( 'id' , {
15
+ description : 'Docker image id' ,
16
+ } )
17
+ . positional ( 'names' , {
18
+ description : 'Tag names' ,
18
19
} ) ;
19
20
20
21
return yargs ;
21
22
} ,
22
23
handler : async ( argv ) => {
23
24
const imageId = argv . id ;
24
- const tags = _ . isArray ( argv . tag ) ? argv . tag : [ argv . tag ] ;
25
+ const tags = argv . tags ;
25
26
for ( let i = 0 ; i < tags . length ; i += 1 ) {
26
27
const tag = tags [ i ] ;
27
28
await image . addImageTag ( {
28
29
imageId,
29
30
tag,
30
31
} ) ;
31
- console . log ( `tag : ${ tag } successfully added to image ${ imageId } ` ) ;
32
+ console . log ( `Tag : ${ tag } was added successfully to image: ${ imageId } ` ) ;
32
33
}
33
34
} ,
34
35
} ) ;
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ const annotateImage = async (dockerImageId, annotations) => {
136
136
} ;
137
137
138
138
const addImageTag = async ( options ) => {
139
- const image = await getImageById ( options . imageId ) ;
139
+ const image = await getImageById ( { imageId : options . imageId } ) ;
140
140
const imageId = image [ 0 ] . info . _id ;
141
141
const RequestOptions = {
142
142
url : `/api/images/${ encodeURIComponent ( imageId ) } /tag/${ options . tag } ` ,
You can’t perform that action at this time.
0 commit comments