@@ -607,13 +607,19 @@ func (p *AWS) GetImages(ctx *lepton.Context) ([]lepton.CloudImage, error) {
607
607
tagName = & ec2.Tag {Value : aws .String ("n/a" )}
608
608
}
609
609
610
+ labels := []string {}
611
+ for _ , tag := range image .Tags {
612
+ labels = append (labels , * tag .Key + ":" + * tag .Value )
613
+ }
614
+
610
615
imageCreatedAt , _ := time .Parse ("2006-01-02T15:04:05Z" , * image .CreationDate )
611
616
612
617
cimage := lepton.CloudImage {
613
618
Tag : * tagName .Value ,
614
619
Name : * image .Name ,
615
620
ID : * image .ImageId ,
616
621
Status : * image .State ,
622
+ Labels : labels ,
617
623
Created : imageCreatedAt ,
618
624
}
619
625
@@ -638,12 +644,13 @@ func (p *AWS) ListImages(ctx *lepton.Context) error {
638
644
} else {
639
645
// default of table output
640
646
table := tablewriter .NewWriter (os .Stdout )
641
- table .SetHeader ([]string {"AmiID" , "AmiName" , "Name" , "Status" , "Created" })
647
+ table .SetHeader ([]string {"AmiID" , "AmiName" , "Name" , "Status" , "Created" , "Labels" })
642
648
table .SetHeaderColor (
643
649
tablewriter.Colors {tablewriter .Bold , tablewriter .FgCyanColor },
644
650
tablewriter.Colors {tablewriter .Bold , tablewriter .FgCyanColor },
645
651
tablewriter.Colors {tablewriter .Bold , tablewriter .FgCyanColor },
646
652
tablewriter.Colors {tablewriter .Bold , tablewriter .FgCyanColor },
653
+ tablewriter.Colors {tablewriter .Bold , tablewriter .FgCyanColor },
647
654
tablewriter.Colors {tablewriter .Bold , tablewriter .FgCyanColor })
648
655
table .SetRowLine (true )
649
656
@@ -655,6 +662,7 @@ func (p *AWS) ListImages(ctx *lepton.Context) error {
655
662
row = append (row , image .Tag )
656
663
row = append (row , image .Status )
657
664
row = append (row , lepton .Time2Human (image .Created ))
665
+ row = append (row , strings .Join (image .Labels [:], "," ))
658
666
659
667
table .Append (row )
660
668
}
0 commit comments