@@ -105,6 +105,10 @@ var listImageCommand = cli.Command{
105
105
Name : "digests" ,
106
106
Usage : "Show digests" ,
107
107
},
108
+ cli.BoolFlag {
109
+ Name : "no-trunc" ,
110
+ Usage : "Show output without truncating the ID" ,
111
+ },
108
112
},
109
113
Action : func (context * cli.Context ) error {
110
114
if err := getImageClient (context ); err != nil {
@@ -129,6 +133,7 @@ var listImageCommand = cli.Command{
129
133
verbose := context .Bool ("verbose" )
130
134
showDigest := context .Bool ("digests" )
131
135
quiet := context .Bool ("quiet" )
136
+ noTrunc := context .Bool ("no-trunc" )
132
137
if ! verbose && ! quiet {
133
138
if showDigest {
134
139
fmt .Fprintln (w , "IMAGE\t TAG\t DIGEST\t IMAGE ID\t SIZE" )
@@ -141,17 +146,19 @@ var listImageCommand = cli.Command{
141
146
fmt .Printf ("%s\n " , image .Id )
142
147
continue
143
148
}
144
-
145
149
if ! verbose {
146
150
imageName , repoDigest := normalizeRepoDigest (image .RepoDigests )
147
151
repoTagPairs := normalizeRepoTagPair (image .RepoTags , imageName )
148
152
size := units .HumanSizeWithPrecision (float64 (image .GetSize_ ()), 3 )
149
- trunctedImage := strings .TrimPrefix (image .Id , "sha256:" )[:truncatedIDLen ]
153
+ id := image .Id
154
+ if ! noTrunc {
155
+ id = strings .TrimPrefix (image .Id , "sha256:" )[:truncatedIDLen ]
156
+ }
150
157
for _ , repoTagPair := range repoTagPairs {
151
158
if showDigest {
152
- fmt .Fprintf (w , "%s\t %s\t %s\t %s\t %s\n " , repoTagPair [0 ], repoTagPair [1 ], repoDigest , trunctedImage , size )
159
+ fmt .Fprintf (w , "%s\t %s\t %s\t %s\t %s\n " , repoTagPair [0 ], repoTagPair [1 ], repoDigest , id , size )
153
160
} else {
154
- fmt .Fprintf (w , "%s\t %s\t %s\t %s\n " , repoTagPair [0 ], repoTagPair [1 ], trunctedImage , size )
161
+ fmt .Fprintf (w , "%s\t %s\t %s\t %s\n " , repoTagPair [0 ], repoTagPair [1 ], id , size )
155
162
}
156
163
}
157
164
continue
0 commit comments