This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 236
/
template_utils.go
103 lines (75 loc) · 3.83 KB
/
template_utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
Copyright 2017 Google, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package util
const FSDiffOutput = `
-----{{.DiffType}}-----
These entries have been added to {{.Image1}}:{{if not .Diff.Adds}} None{{else}}
FILE SIZE{{range .Diff.Adds}}{{"\n"}}{{.Name}} {{.Size}}{{end}}{{end}}
These entries have been deleted from {{.Image1}}:{{if not .Diff.Dels}} None{{else}}
FILE SIZE{{range .Diff.Dels}}{{"\n"}}{{.Name}} {{.Size}}{{end}}{{end}}
These entries have been changed between {{.Image1}} and {{.Image2}}:{{if not .Diff.Mods}} None{{else}}
FILE SIZE1 SIZE2{{range .Diff.Mods}}{{"\n"}}{{.Name}} {{.Size1}} {{.Size2}}{{end}}
{{end}}
`
const SingleVersionDiffOutput = `
-----{{.DiffType}}-----
Packages found only in {{.Image1}}:{{if not .Diff.Packages1}} None{{else}}
NAME VERSION SIZE{{range .Diff.Packages1}}{{"\n"}}{{print "-"}}{{.Name}} {{.Version}} {{.Size}}{{end}}{{end}}
Packages found only in {{.Image2}}:{{if not .Diff.Packages2}} None{{else}}
NAME VERSION SIZE{{range .Diff.Packages2}}{{"\n"}}{{print "-"}}{{.Name}} {{.Version}} {{.Size}}{{end}}{{end}}
Version differences:{{if not .Diff.InfoDiff}} None{{else}}
PACKAGE IMAGE1 ({{.Image1}}) IMAGE2 ({{.Image2}}){{range .Diff.InfoDiff}}{{"\n"}}{{print "-"}}{{.Package}} {{.Info1.Version}}, {{.Info1.Size}} {{.Info2.Version}}, {{.Info2.Size}}{{end}}
{{end}}
`
const MultiVersionDiffOutput = `
-----{{.DiffType}}-----
Packages found only in {{.Image1}}:{{if not .Diff.Packages1}} None{{else}}
NAME VERSION SIZE{{range .Diff.Packages1}}{{"\n"}}{{print "-"}}{{.Name}} {{.Version}} {{.Size}}{{end}}{{end}}
Packages found only in {{.Image2}}:{{if not .Diff.Packages2}} None{{else}}
NAME VERSION SIZE{{range .Diff.Packages2}}{{"\n"}}{{print "-"}}{{.Name}} {{.Version}} {{.Size}}{{end}}{{end}}
Version differences:{{if not .Diff.InfoDiff}} None{{else}}
PACKAGE IMAGE1 ({{.Image1}}) IMAGE2 ({{.Image2}}){{range .Diff.InfoDiff}}{{"\n"}}{{print "-"}}{{.Package}} {{range .Info1}}{{.Version}}, {{.Size}}{{end}} {{range .Info2}}{{.Version}}, {{.Size}}{{end}}{{end}}
{{end}}
`
const HistoryDiffOutput = `
-----{{.DiffType}}-----
Docker history lines found only in {{.Image1}}:{{if not .Diff.Adds}} None{{else}}{{block "list" .Diff.Adds}}{{"\n"}}{{range .}}{{print "-" .}}{{"\n"}}{{end}}{{end}}{{end}}
Docker history lines found only in {{.Image2}}:{{if not .Diff.Dels}} None{{else}}{{block "list2" .Diff.Dels}}{{"\n"}}{{range .}}{{print "-" .}}{{"\n"}}{{end}}{{end}}{{end}}
`
const FilenameDiffOutput = `
-----Diff of {{.Filename}}-----
{{.Description}}
{{.Diff}}
`
const ListAnalysisOutput = `
-----{{.AnalyzeType}}-----
Analysis for {{.Image}}:{{if not .Analysis}} None{{else}}{{block "list" .Analysis}}{{"\n"}}{{range .}}{{print "-" .}}{{"\n"}}{{end}}{{end}}{{end}}
`
const FileAnalysisOutput = `
-----{{.AnalyzeType}}-----
Analysis for {{.Image}}:{{if not .Analysis}} None{{else}}
FILE SIZE{{range .Analysis}}{{"\n"}}{{.Name}} {{.Size}}{{end}}
{{end}}
`
const MultiVersionPackageOutput = `
-----{{.AnalyzeType}}-----
Packages found in {{.Image}}:{{if not .Analysis}} None{{else}}
NAME VERSION SIZE INSTALLATION{{range .Analysis}}{{"\n"}}{{print "-"}}{{.Name}} {{.Version}} {{.Size}} {{.Path}}{{end}}
{{end}}
`
const SingleVersionPackageOutput = `
-----{{.AnalyzeType}}-----
Packages found in {{.Image}}:{{if not .Analysis}} None{{else}}
NAME VERSION SIZE{{range .Analysis}}{{"\n"}}{{print "-"}}{{.Name}} {{.Version}} {{.Size}}{{end}}
{{end}}
`